mdl 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +79 -0
  7. data/Rakefile +8 -0
  8. data/bin/mdl +10 -0
  9. data/docs/RULES.md +609 -0
  10. data/docs/creating_rules.md +83 -0
  11. data/docs/creating_styles.md +47 -0
  12. data/example/markdown_spec.md +897 -0
  13. data/lib/mdl.rb +72 -0
  14. data/lib/mdl/cli.rb +89 -0
  15. data/lib/mdl/config.rb +9 -0
  16. data/lib/mdl/doc.rb +252 -0
  17. data/lib/mdl/kramdown_parser.rb +29 -0
  18. data/lib/mdl/rules.rb +393 -0
  19. data/lib/mdl/ruleset.rb +47 -0
  20. data/lib/mdl/style.rb +50 -0
  21. data/lib/mdl/styles/all.rb +1 -0
  22. data/lib/mdl/styles/cirosantilli.rb +6 -0
  23. data/lib/mdl/styles/default.rb +1 -0
  24. data/lib/mdl/styles/relaxed.rb +6 -0
  25. data/lib/mdl/version.rb +3 -0
  26. data/mdl.gemspec +31 -0
  27. data/test/rule_tests/atx_closed_header_spacing.md +17 -0
  28. data/test/rule_tests/atx_header_spacing.md +5 -0
  29. data/test/rule_tests/blockquote_blank_lines.md +31 -0
  30. data/test/rule_tests/blockquote_spaces.md +21 -0
  31. data/test/rule_tests/bulleted_list_2_space_indent.md +6 -0
  32. data/test/rule_tests/bulleted_list_2_space_indent_style.rb +2 -0
  33. data/test/rule_tests/bulleted_list_4_space_indent.md +3 -0
  34. data/test/rule_tests/bulleted_list_not_at_beginning_of_line.md +14 -0
  35. data/test/rule_tests/code_block_dollar.md +22 -0
  36. data/test/rule_tests/consecutive_blank_lines.md +11 -0
  37. data/test/rule_tests/consistent_bullet_styles_asterisk.md +3 -0
  38. data/test/rule_tests/consistent_bullet_styles_dash.md +3 -0
  39. data/test/rule_tests/consistent_bullet_styles_plus.md +3 -0
  40. data/test/rule_tests/empty_doc.md +0 -0
  41. data/test/rule_tests/fenced_code_blocks.md +21 -0
  42. data/test/rule_tests/first_header_bad_atx.md +1 -0
  43. data/test/rule_tests/first_header_bad_setext.md +2 -0
  44. data/test/rule_tests/first_header_good_atx.md +1 -0
  45. data/test/rule_tests/first_header_good_setext.md +2 -0
  46. data/test/rule_tests/header_duplicate_content.md +11 -0
  47. data/test/rule_tests/header_multiple_toplevel.md +3 -0
  48. data/test/rule_tests/header_mutliple_h1_no_toplevel.md +5 -0
  49. data/test/rule_tests/header_trailing_punctuation.md +11 -0
  50. data/test/rule_tests/header_trailing_punctuation_customized.md +14 -0
  51. data/test/rule_tests/header_trailing_punctuation_customized_style.rb +2 -0
  52. data/test/rule_tests/headers_bad.md +7 -0
  53. data/test/rule_tests/headers_good.md +5 -0
  54. data/test/rule_tests/headers_surrounding_space_atx.md +9 -0
  55. data/test/rule_tests/headers_surrounding_space_setext.md +15 -0
  56. data/test/rule_tests/headers_with_spaces_at_the_beginning.md +9 -0
  57. data/test/rule_tests/inconsistent_bullet_indent_same_level.md +4 -0
  58. data/test/rule_tests/inconsistent_bullet_styles_asterisk.md +3 -0
  59. data/test/rule_tests/inconsistent_bullet_styles_dash.md +3 -0
  60. data/test/rule_tests/inconsistent_bullet_styles_plus.md +3 -0
  61. data/test/rule_tests/incorrect_bullet_style_asterisk.md +3 -0
  62. data/test/rule_tests/incorrect_bullet_style_asterisk_style.rb +2 -0
  63. data/test/rule_tests/incorrect_bullet_style_dash.md +3 -0
  64. data/test/rule_tests/incorrect_bullet_style_dash_style.rb +2 -0
  65. data/test/rule_tests/incorrect_bullet_style_plus.md +3 -0
  66. data/test/rule_tests/incorrect_bullet_style_plus_style.rb +2 -0
  67. data/test/rule_tests/incorrect_header_atx.md +6 -0
  68. data/test/rule_tests/incorrect_header_atx_closed.md +6 -0
  69. data/test/rule_tests/incorrect_header_atx_closed_style.rb +2 -0
  70. data/test/rule_tests/incorrect_header_atx_style.rb +2 -0
  71. data/test/rule_tests/incorrect_header_setext.md +6 -0
  72. data/test/rule_tests/incorrect_header_setext_style.rb +2 -0
  73. data/test/rule_tests/long_lines.md +3 -0
  74. data/test/rule_tests/long_lines_100.md +7 -0
  75. data/test/rule_tests/long_lines_100_style.rb +2 -0
  76. data/test/rule_tests/mixed_header_types_atx.md +6 -0
  77. data/test/rule_tests/mixed_header_types_atx_closed.md +6 -0
  78. data/test/rule_tests/mixed_header_types_setext.md +6 -0
  79. data/test/rule_tests/ordered_list_item_prefix.md +13 -0
  80. data/test/rule_tests/ordered_list_item_prefix_ordered.md +13 -0
  81. data/test/rule_tests/ordered_list_item_prefix_ordered_style.rb +2 -0
  82. data/test/rule_tests/reversed_link.md +7 -0
  83. data/test/rule_tests/spaces_after_list_marker.md +74 -0
  84. data/test/rule_tests/spaces_after_list_marker_style.rb +3 -0
  85. data/test/rule_tests/whitespace issues.md +3 -0
  86. data/test/setup_tests.rb +5 -0
  87. data/test/test_ruledocs.rb +45 -0
  88. data/test/test_rules.rb +56 -0
  89. data/tools/README.md +3 -0
  90. data/tools/test_location.rb +20 -0
  91. data/tools/view_markdown.rb +11 -0
  92. metadata +314 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e214c7494f0a1796f51fea727bc16877f8b9aa82
4
+ data.tar.gz: 6342d6617202c3512dd2a0d721c321a0a9fa0edd
5
+ SHA512:
6
+ metadata.gz: bad0ee00e294fc844d26a47964008ec31ecd62ac696daa2cd43b81183063ef5eb647237df26b0f9b455a741b6d77d77a6080ab7d7eb5aa9c9572748b9db75235
7
+ data.tar.gz: aa8a0269c402be1dd9ef0a0cdcfce900026c3726a73d8d2cc31b34080968c736131976e65386291088ed34ae6601f2958db1f4527ffdad76455b645691fea3c2
@@ -0,0 +1,13 @@
1
+ # Bundler/Ruby
2
+ vendor/
3
+ .bundle
4
+ Gemfile.lock
5
+ spec/reports
6
+ tmp
7
+ *.gem
8
+
9
+ # Vim
10
+ *.swp
11
+
12
+ # Mac
13
+ .DS_Store
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.2"
4
+ - "1.9.3"
5
+ - "2.1.0"
6
+ - "2.1.1"
7
+ - jruby-19mode # JRuby in 1.9 mode
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Mark Harrison
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,79 @@
1
+ [![Issues on deck](https://badge.waffle.io/mivok/markdownlint.png?label=on%20deck&title=On%20Deck)](https://waffle.io/mivok/markdownlint)
2
+ [![Travis build status](http://api.travis-ci.org/mivok/markdownlint.svg)](https://travis-ci.org/mivok/markdownlint)
3
+
4
+ # Markdown lint tool
5
+
6
+ A tool to check markdown files and flag style issues.
7
+
8
+ ## Installation
9
+
10
+ Markdownlint is written in ruby and is distributed as a rubygem. As long as
11
+ you have a relatively up to date ruby on your system, markdownlint will be
12
+ simple to install and use.
13
+
14
+ To install from rubygems, run:
15
+
16
+ gem install markdownlint
17
+
18
+ To install the latest development version from github:
19
+
20
+ git clone https://github.com/mivok/markdownlint
21
+ cd markdownlint
22
+ rake install
23
+
24
+ ## Usage
25
+
26
+ To have markdownlint check your markdown files, simply run `mdl` with the
27
+ filenames as a parameter:
28
+
29
+ mdl README.md
30
+
31
+ Markdownlint can also take a directory, and it will scan all markdown files
32
+ within the directory (and nested directories):
33
+
34
+ mdl docs/
35
+
36
+ If you don't specify a filename, markdownlint will use stdin:
37
+
38
+ cat foo.md | mdl
39
+
40
+ Markdownlint will output a list of issues it finds, and the line number where
41
+ the issue is. See [RULES.md](docs/RULES.md) for information on each issue, as
42
+ well as how to correct it:
43
+
44
+ README.md:1: MD013 Line length
45
+ README.md:70: MD029 Ordered list item prefix
46
+ README.md:71: MD029 Ordered list item prefix
47
+ README.md:72: MD029 Ordered list item prefix
48
+ README.md:73: MD029 Ordered list item prefix
49
+
50
+ Markdownlint has many more options you can pass on the command line, run
51
+ `mdl --help` to see what they are.
52
+
53
+ ### Styles
54
+
55
+ Not everyone writes markdown in the same way, and there are multiple flavors
56
+ and styles, each of which are valid. While markdownlint's default settings
57
+ will result in markdown files that reflect the author's preferred markdown
58
+ authoring preferences, your project may have different guidelines.
59
+
60
+ It's not markdownlint's intention to dictate any one specific style, and in
61
+ order to support these differing styles and/or preferences, markdownlint
62
+ supports what are called 'style files'. A style file is a file describing
63
+ which rules markdownlint should enable, and also what settings to apply to
64
+ individual rules. For example, rule [MD013](docs/RULES.md#md013---line-length)
65
+ checks for long lines, and by default will report an issue for any line longer
66
+ than 80 characters. If your project has a different maximum line length limit,
67
+ or if you don't want to enforce a line limit at all, then this can be
68
+ configured in a style file.
69
+
70
+ For more information on creating style files, see the
71
+ [creating styles](docs/creating_styles.md) document.
72
+
73
+ ## Contributing
74
+
75
+ 1. Fork it ( http://github.com/mivok/markdownlint/fork )
76
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
77
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
78
+ 1. Push to the branch (`git push origin my-new-feature`)
79
+ 1. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ task :default => :test
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.pattern = "test/test_*.rb"
8
+ end
data/bin/mdl ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require 'mdl'
4
+ rescue LoadError
5
+ # For running in development without bundler
6
+ $: << File.expand_path("../lib", File.dirname(__FILE__))
7
+ require 'mdl'
8
+ end
9
+
10
+ MarkdownLint::run
@@ -0,0 +1,609 @@
1
+ # Rules
2
+
3
+ This document contains a description of all rules, what they are checking for,
4
+ as well as an examples of documents that break the rule and corrected
5
+ versions of the examples.
6
+
7
+ ## MD001 - Header levels should only increment by one level at a time
8
+
9
+ Tags: headers
10
+
11
+ This rule is triggered when you skip header levels in a markdown document, for
12
+ example:
13
+
14
+ # Header 1
15
+
16
+ ### Header 3
17
+
18
+ We skipped out a 2nd level header in this document
19
+
20
+ When using multiple header levels, nested headers should increase by only one
21
+ level at a time:
22
+
23
+ # Header 1
24
+
25
+ ## Header 2
26
+
27
+ ### Header 3
28
+
29
+ #### Header 4
30
+
31
+ ## Another Header 2
32
+
33
+ ### Another Header 3
34
+
35
+
36
+ ## MD002 - First header should be a h1 header
37
+
38
+ Tags: headers
39
+
40
+ This rule is triggered when the first header in the document isn't a h1 header:
41
+
42
+ ## This isn't a H1 header
43
+
44
+ ### Another header
45
+
46
+ The first header in the document should be a h1 header:
47
+
48
+ # Start with a H1 header
49
+
50
+ ## Then use a H2 for subsections
51
+
52
+ ## MD003 - Header style
53
+
54
+ Tags: headers
55
+
56
+ Parameters: style
57
+
58
+ This rule is triggered when different header styles (atx, setext, and 'closed'
59
+ atx) are used in the same document:
60
+
61
+ # ATX style H1
62
+
63
+ ## Closed ATX style H2 ##
64
+
65
+ Setext style H1
66
+ ===============
67
+
68
+ Be consistent with the style of header used in a document:
69
+
70
+ # ATX style H1
71
+
72
+ ## ATX style H2
73
+
74
+ Note: the configured header style can be a specific style to use (atx,
75
+ atx_closed, setext), or simply require that the usage be consistent within the
76
+ document.
77
+
78
+ ## MD004 - Unordered list style
79
+
80
+ Tags: bullet, ul
81
+
82
+ Parameters: style
83
+
84
+ This rule is triggered when the symbols used in the document for unordered
85
+ list items do not match the configured unordered list style:
86
+
87
+ * Item 1
88
+ + Item 2
89
+ - Item 3
90
+
91
+ To fix this issue, use the configured style for list items throughout the
92
+ document:
93
+
94
+ * Item 1
95
+ * Item 2
96
+ * Item 3
97
+
98
+ Note: the configured list style can be a specific symbol to use (asterisk,
99
+ plus, dash), or simply require that the usage be consistent within the
100
+ document.
101
+
102
+ ## MD005 - Inconsistent indentation for list items at the same level
103
+
104
+ Tags: bullet, ul, indentation
105
+
106
+ This rule is triggered when list items are parsed as being at the same level,
107
+ but don't have the same indentation:
108
+
109
+ * Item 1
110
+ * Nested Item 1
111
+ * Nested Item 2
112
+ * A misaligned item
113
+
114
+ Usually this rule will be triggered because of a typo. Correct the indentation
115
+ for the list to fix it:
116
+
117
+ * Item 1
118
+ * Nested Item 1
119
+ * Nested Item 2
120
+ * Nested Item 3
121
+
122
+ ## MD006 - Consider starting bulleted lists at the beginning of the line
123
+
124
+ Tags: bullet, ul, indentation
125
+
126
+ This rule is triggered when top level lists don't start at the beginning of a
127
+ line:
128
+
129
+ Some text
130
+
131
+ * List item
132
+ * List item
133
+
134
+ To fix, ensure that top level list items are not indented:
135
+
136
+
137
+ Some test
138
+
139
+ * List item
140
+ * List item
141
+
142
+ Rationale: Starting lists at the beginning of the line means that nested list
143
+ items can all be indented by the same amount when an editor's indent function
144
+ or the tab key is used to indent. Starting a list 1 space in means that the
145
+ indent of the first nested list is less than the indent of the second level (3
146
+ characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
147
+
148
+ ## MD007 - Unordered list indentation
149
+
150
+ Tags: bullet, ul, indentation
151
+
152
+ Parameters: indent
153
+
154
+ This rule is triggered when list items are not indented by the configured
155
+ number of spaces (default: 2).
156
+
157
+ Example:
158
+
159
+ * List item
160
+ * Nested list item indented by 3 spaces
161
+
162
+ Corrected Example:
163
+
164
+ * List item
165
+ * Nested list item indented by 2 spaces
166
+
167
+ Rationale (2 space indent): indending by 2 spaces allows the content of a
168
+ nested list to be in line with the start of the content of the parent list
169
+ when a single space is used after the list marker.
170
+
171
+ Rationale (4 space indent): Same indent as code blocks, simpler for editors to
172
+ implement. See
173
+ <http://www.cirosantilli.com/markdown-styleguide/#indented-lists> for more
174
+ information.
175
+
176
+ In addition, this is a compatibility issue with multi-markdown parsers, which
177
+ require a 4 space indents. See
178
+ <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>
179
+ for a description of the problem.
180
+
181
+ ## MD009 - Trailing spaces
182
+
183
+ Tags: whitespace
184
+
185
+ This rule is triggered on any lines that end with whitespace. To fix this,
186
+ find the line that is triggered and remove any trailing spaces from the end.
187
+
188
+ ## MD010 - Hard tabs
189
+
190
+ Tags: whitespace, hard_tab
191
+
192
+ This rule is triggered any any lines that contain hard tab characters instead
193
+ of using spaces for indentation. To fix this, replace any hard tab characters
194
+ with spaces instead.
195
+
196
+ Example:
197
+
198
+ Some text
199
+
200
+ * hard tab character used to indent the list item
201
+
202
+ Corrected example:
203
+
204
+ Some text
205
+
206
+ * Spaces used to indent the list item instead
207
+
208
+ ## MD011 - Reversed link syntax
209
+
210
+ Tags: links
211
+
212
+ This rule is triggered when text that appears to be a link is encountered, but
213
+ where the syntax appears to have been reversed (the `[]` and `()` are
214
+ reversed):
215
+
216
+ (Incorrect link syntax)[http://www.example.com/]
217
+
218
+ To fix this, swap the `[]` and `()` around:
219
+
220
+ [Correct link syntax](http://www.example.com/)
221
+
222
+ ## MD012 - Multiple consecutive blank lines
223
+
224
+ Tags: whitespace, blank_lines
225
+
226
+ This rule is triggered when there are multiple consecutive blank lines in the
227
+ document:
228
+
229
+ Some text here
230
+
231
+
232
+ Some more text here
233
+
234
+ To fix this, delete the offending lines:
235
+
236
+ Some text here
237
+
238
+ Some more text here
239
+
240
+ Note: this rule will not be triggered if there are multiple consecutive blank
241
+ lines inside code blocks.
242
+
243
+ ## MD013 - Line length
244
+
245
+ Tags: line_length
246
+
247
+ Parameters: line_length
248
+
249
+ This rule is triggered when there are lines that are longer than the
250
+ configured line length (default: 80 characters). To fix this, split the line
251
+ up into multiple lines.
252
+
253
+ This rule has an exception where there is no whitespace beyond the configured
254
+ line length. This allows you to still include items such as long URLs without
255
+ being forced to break them in the middle.
256
+
257
+ ## MD014 - Dollar signs used before commands without showing output
258
+
259
+ Tags: code
260
+
261
+ This rule is triggered when there are code blocks showing shell commands to be
262
+ typed, and the shell commands are preceded by dollar signs ($):
263
+
264
+ $ ls
265
+ $ cat foo
266
+ $ less bar
267
+
268
+ The dollar signs are unnecessary in the above situation, and should not be
269
+ included:
270
+
271
+ ls
272
+ cat foo
273
+ less bar
274
+
275
+ However, an exception is made when there is a need to distinguish between
276
+ typed commands and command output, as in the following example:
277
+
278
+ $ ls
279
+ foo bar
280
+ $ cat foo
281
+ Hello world
282
+ $ cat bar
283
+ baz
284
+
285
+ Rationale: it is easier to copy and paste and less noisy if the dollar signs
286
+ are omitted when they are not needed. See
287
+ <http://www.cirosantilli.com/markdown-styleguide/#dollar-signs-in-shell-code>
288
+ for more information.
289
+
290
+ ## MD018 - No space after hash on atx style header
291
+
292
+ Tags: headers, atx, spaces
293
+
294
+ This rule is triggered when when spaces are missing after the hash characters
295
+ in an atx style header:
296
+
297
+ #Header 1
298
+
299
+ ##Header 2
300
+
301
+ To fix this, separate the header text from the hash character by a single
302
+ space:
303
+
304
+ # Header 1
305
+
306
+ ## Header 2
307
+
308
+ ## MD019 - Multiple spaces after hash on atx style header
309
+
310
+ Tags: headers, atx, spaces
311
+
312
+ This rule is triggered when when more than one space is used to separate the
313
+ header text from the hash characters in an atx style header:
314
+
315
+ # Header 1
316
+
317
+ ## Header 2
318
+
319
+ To fix this, separate the header text from the hash character by a single
320
+ space:
321
+
322
+ # Header 1
323
+
324
+ ## Header 2
325
+
326
+ ## MD020 - No space inside hashes on closed atx style header
327
+
328
+ Tags: headers, atx_closed, spaces
329
+
330
+ This rule is triggered when when spaces are missing inside the hash characters
331
+ in a closed atx style header:
332
+
333
+ #Header 1#
334
+
335
+ ##Header 2##
336
+
337
+ To fix this, separate the header text from the hash character by a single
338
+ space:
339
+
340
+ # Header 1 #
341
+
342
+ ## Header 2 ##
343
+
344
+ Note: this rule will fire if either side of the header is missing spaces.
345
+
346
+ ## MD021 - Multiple spaces inside hashes on closed atx style header
347
+
348
+ Tags: headers, atx_closed, spaces
349
+
350
+ This rule is triggered when when more than one space is used to separate the
351
+ header text from the hash characters in a closed atx style header:
352
+
353
+ # Header 1 #
354
+
355
+ ## Header 2 ##
356
+
357
+ To fix this, separate the header text from the hash character by a single
358
+ space:
359
+
360
+ # Header 1 #
361
+
362
+ ## Header 2 ##
363
+
364
+ Note: this rule will fire if either side of the header contains multiple
365
+ spaces.
366
+
367
+ ## MD022 - Headers should be surrounded by blank lines
368
+
369
+ Tags: headers, blank_lines
370
+
371
+ This rule is triggered when headers (any style) are either not preceded or not
372
+ followed by a blank line:
373
+
374
+ # Header 1
375
+ Some text
376
+
377
+ Some more text
378
+ ## Header 2
379
+
380
+ To fix this, ensure that all headers have a blank line both before and after
381
+ (except where the header is at the beginning or end of the document):
382
+
383
+ # Header 1
384
+
385
+ Some text
386
+
387
+ Some more text
388
+
389
+ ## Header 2
390
+
391
+ Rationale: Aside from asthetic reasons, some parsers, including kramdown, will
392
+ not parse headers that don't have a blank line before, and will parse them as
393
+ regular text.
394
+
395
+ ## MD023 - Headers must start at the beginning of the line
396
+
397
+ Tags: headers, spaces
398
+
399
+ This rule is triggered when a header is indented by one or more spaces:
400
+
401
+ Some text
402
+
403
+ # Indented header
404
+
405
+ To fix this, ensure that all headers start at the beginning of the line:
406
+
407
+ Some text
408
+
409
+ # Header
410
+
411
+ Rationale: Headers that don't start at the beginning of the line will not be
412
+ parsed as headers, and will instead appear as regular text.
413
+
414
+ ## MD024 - Multiple headers with the same content
415
+
416
+ Tags: headers
417
+
418
+ This rule is triggered if there are multiple headers in the document that have
419
+ the same text:
420
+
421
+ # Some text
422
+
423
+ ## Some text
424
+
425
+ To fix this, ensure that the content of each header is different:
426
+
427
+ # Some text
428
+
429
+ ## Some more text
430
+
431
+ Rationale: Some markdown parses generate anchors for headers based on the
432
+ header name, and having headers with the same content can cause problems with
433
+ this.
434
+
435
+ ## MD025 - Multiple top level headers in the same document
436
+
437
+ Tags: headers
438
+
439
+ This rule is triggered when a top level header is in use (the first line of
440
+ the file is a h1 header), and more than one h1 header is in use in the
441
+ document:
442
+
443
+ # Top level header
444
+
445
+ # Another top level header
446
+
447
+ To fix, structure your document so that there is a single h1 header that is
448
+ the title for the document, and all later headers are h2 or lower level
449
+ headers:
450
+
451
+ # Title
452
+
453
+ ## Header
454
+
455
+ ## Another header
456
+
457
+ Rationale: A top level header is a h1 on the first line of the file, and
458
+ serves as the title for the document. If this convention is in use, then there
459
+ can not be more than one title for the document, and the entire document
460
+ should be contained within this header.
461
+
462
+ ## MD026 - Trailing punctuation in header
463
+
464
+ Tags: headers
465
+
466
+ Parameters: punctuation
467
+
468
+ This rule is triggered on any header that has a punctuation character as the
469
+ last character in the line:
470
+
471
+ # This is a header.
472
+
473
+ To fix this, remove any trailing punctuation:
474
+
475
+ # This is a header
476
+
477
+ Note: The punctuation parameter can be used to specify what characters class
478
+ as punctuation at the end of the header. For example, you can set it to
479
+ `'.,;:!'` to allow headers with question marks in them, such as might be used
480
+ in an FAQ.
481
+
482
+ ## MD027 - Multiple spaces after blockquote symbol
483
+
484
+ Tags: blockquote, whitespace, indentation
485
+
486
+ This rule is triggered when blockquotes have more than one space after the
487
+ blockquote (`>`) symbol:
488
+
489
+ > This is a block quote with bad indentation
490
+ > there should only be one.
491
+
492
+ To fix, remove any extraneous space:
493
+
494
+ > This is a blockquote with correct
495
+ > indentation.
496
+
497
+ ## MD028 - Blank line inside blockquote
498
+
499
+ Tags: blockquote, whitespace
500
+
501
+ This rule is triggered when two blockquote blocks are separated by nothing
502
+ except for a blank line:
503
+
504
+ > This is a blockquote
505
+ > which is immediately followed by
506
+
507
+ > this blockquote. Unfortunately
508
+ > In some parsers, these are treated as the same blockquote.
509
+
510
+ To fix this, ensure that any blockquotes that are right next to each other
511
+ have some text in between:
512
+
513
+ > This is a blockquote.
514
+
515
+ And Jimmy also said:
516
+
517
+ > This too is a blockquote.
518
+
519
+ Alternatively, if they are supposed to be the same quote, then add the
520
+ blockquote symbol at the beginning of the blank line:
521
+
522
+ > This is a blockquote.
523
+ >
524
+ > This is the same blockquote.
525
+
526
+ Rationale: Some markdown parsers will treat two blockquotes separated by one
527
+ or more blank lines as the same blockquote, while others will treat them as
528
+ separate blockquotes.
529
+
530
+ ## MD029 - Ordered list item prefix
531
+
532
+ Tags: ol
533
+
534
+ Parameters: style
535
+
536
+ This rule is triggered on ordered lists that do not either start with '1.' or
537
+ do not have a prefix that increases in numerical order (depending on the
538
+ configured style, which defaults to 'one').
539
+
540
+ Example valid list if the style is configured as 'one':
541
+
542
+ 1. Do this.
543
+ 1. Do that.
544
+ 1. Done.
545
+
546
+ Example valid list if the style is configured as 'ordered':
547
+
548
+ 1. Do this.
549
+ 2. Do that.
550
+ 3. Done.
551
+
552
+ ## MD030 - Spaces after list markers
553
+
554
+ Tags: ol, ul, whitespace
555
+
556
+ Parameters: ul_single, ol_single, ul_multi, ol_multi
557
+
558
+ This rule checks for the number of spaces between a list marker (e.g. '`-`',
559
+ '`*`', '`+`' or '`1.`') and the text of the list item.
560
+
561
+ The number of spaces checked for depends on the document style in use, but the
562
+ default is 1 space after any list marker:
563
+
564
+ * Foo
565
+ * Bar
566
+ * Baz
567
+
568
+ 1. Foo
569
+ 1. Bar
570
+ 1. Baz
571
+
572
+ 1. Foo
573
+ * Bar
574
+ 1. Baz
575
+
576
+ A document style may change the number of spaces after unordered list items
577
+ and ordered list items independently, as well as based on whether the content
578
+ of every item in the list consists of a single paragraph, or multiple
579
+ paragraphs (including sub-lists and code blocks).
580
+
581
+ For example, the style guide at
582
+ <http://www.cirosantilli.com/markdown-styleguide/#spaces-after-marker>
583
+ specifies that 1 space after the list marker should be used if every item in
584
+ the list fits within a single paragraph, but to use 2 or 3 spaces (for ordered
585
+ and unordered lists respectively) if there are multiple paragraphs of content
586
+ inside the list:
587
+
588
+ * Foo
589
+ * Bar
590
+ * Baz
591
+
592
+ vs.
593
+
594
+ * Foo
595
+
596
+ Second paragraph
597
+
598
+ * Bar
599
+
600
+ or
601
+
602
+ 1. Foo
603
+
604
+ Second paragraph
605
+
606
+ 1. Bar
607
+
608
+ To fix this, ensure the correct number of spaces are used after list marker
609
+ for your selected document style.