8
8
9
9
10
10
@linter (executable = 'remark' ,
11
- use_stdin = True ,
12
11
use_stdout = True ,
13
12
use_stderr = True )
14
13
class MarkdownBear :
@@ -21,7 +20,8 @@ class MarkdownBear:
21
20
22
21
LANGUAGES = {'Markdown' }
23
22
REQUIREMENTS = {NpmRequirement ('remark-cli' , '2' ),
24
- NpmRequirement ('remark-lint' , '5' )}
23
+ NpmRequirement ('remark-lint' , '5' ),
24
+ NpmRequirement ('remark-validate-links' , '5' )}
25
25
AUTHORS = {'The coala developers' }
26
26
AUTHORS_EMAILS = {'coala-devel@googlegroups.com' }
27
27
LICENSE = 'AGPL-3.0'
@@ -65,7 +65,8 @@ def create_arguments(filename, file, config_file,
65
65
horizontal_rule : str = '*' ,
66
66
horizontal_rule_spaces : bool = False ,
67
67
horizontal_rule_repeat : int = 3 ,
68
- max_line_length : int = None ):
68
+ max_line_length : int = None ,
69
+ check_links : bool = False ):
69
70
"""
70
71
:param bullets:
71
72
Character to use for bullets in lists. Can be "-", "*" or "+".
@@ -108,6 +109,8 @@ def create_arguments(filename, file, config_file,
108
109
The number of times the horizontal rule character will be repeated.
109
110
:param max_line_length:
110
111
The maximum line length allowed.
112
+ :param check_links:
113
+ Checks if links to headings and files in markdown are valid.
111
114
"""
112
115
remark_configs_settings = {
113
116
'bullet' : bullets , # - or *
@@ -136,13 +139,16 @@ def create_arguments(filename, file, config_file,
136
139
# Remove { and } as remark adds them on its own
137
140
settings = config_json [1 :- 1 ]
138
141
139
- args = ['--no-color' , '--quiet' , '--setting' , settings ]
142
+ args = [filename , '--no-color' , '--quiet' , '--setting' , settings ]
140
143
141
144
if remark_configs_plugins :
142
145
config_json = json .dumps (remark_configs_plugins )
143
146
plugins = 'lint=' + config_json [1 :- 1 ]
144
147
args += ['--use' , plugins ]
145
148
149
+ if check_links :
150
+ args += ['--use' , 'validate-links' ]
151
+
146
152
return args
147
153
148
154
def process_output (self , output , filename , file ):
0 commit comments