mdl 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/CHANGELOG.md +45 -0
  4. data/README.md +1 -0
  5. data/docs/RULES.md +116 -6
  6. data/docs/configuration.md +16 -1
  7. data/docs/creating_rules.md +7 -0
  8. data/lib/mdl.rb +26 -9
  9. data/lib/mdl/cli.rb +60 -9
  10. data/lib/mdl/doc.rb +5 -1
  11. data/lib/mdl/rules.rb +80 -6
  12. data/lib/mdl/ruleset.rb +16 -7
  13. data/lib/mdl/style.rb +6 -0
  14. data/lib/mdl/styles/default.rb +2 -1
  15. data/lib/mdl/styles/relaxed.rb +1 -0
  16. data/lib/mdl/version.rb +1 -1
  17. data/mdl.gemspec +1 -1
  18. data/test/fixtures/default_mdlrc +1 -0
  19. data/test/fixtures/dir_with_md_and_markdown/bar.markdown +1 -0
  20. data/test/fixtures/dir_with_md_and_markdown/foo.md +1 -0
  21. data/test/fixtures/mdlrc_disable_rules +1 -0
  22. data/test/fixtures/mdlrc_disable_tags +1 -0
  23. data/test/fixtures/mdlrc_enable_rules +1 -0
  24. data/test/fixtures/mdlrc_enable_tags +1 -0
  25. data/test/fixtures/my_ruleset.rb +6 -0
  26. data/test/rule_tests/blockquote_spaces.md +6 -4
  27. data/test/rule_tests/bulleted_list_2_space_indent_style.rb +1 -0
  28. data/test/rule_tests/code_block_dollar_fence.md +29 -0
  29. data/test/rule_tests/default_test_style.rb +4 -0
  30. data/test/rule_tests/fenced_code_with_nesting.md +73 -0
  31. data/test/rule_tests/fenced_code_without_blank_lines_style.rb +1 -0
  32. data/test/rule_tests/first_line_top_level_header_atx.md +3 -0
  33. data/test/rule_tests/first_line_top_level_header_atx_style.rb +2 -0
  34. data/test/rule_tests/first_line_top_level_header_setext.md +4 -0
  35. data/test/rule_tests/first_line_top_level_header_setext_style.rb +2 -0
  36. data/test/rule_tests/headers_good_setext_with_atx.md +7 -0
  37. data/test/rule_tests/headers_good_setext_with_atx_style.rb +2 -0
  38. data/test/rule_tests/hr_style_dashes_style.rb +1 -0
  39. data/test/rule_tests/hr_style_long_style.rb +1 -0
  40. data/test/rule_tests/hr_style_stars_style.rb +1 -0
  41. data/test/rule_tests/incorrect_bullet_style_asterisk_style.rb +1 -0
  42. data/test/rule_tests/incorrect_bullet_style_dash_style.rb +1 -0
  43. data/test/rule_tests/incorrect_bullet_style_plus_style.rb +1 -0
  44. data/test/rule_tests/long_lines_100_style.rb +1 -0
  45. data/test/rule_tests/long_lines_code.md +38 -0
  46. data/test/rule_tests/long_lines_code_style.rb +3 -0
  47. data/test/rule_tests/no_first_line_header.md +1 -0
  48. data/test/rule_tests/no_first_line_header_style.rb +1 -0
  49. data/test/rule_tests/no_first_line_top_level_header.md +1 -0
  50. data/test/rule_tests/no_first_line_top_level_header_style.rb +1 -0
  51. data/test/rule_tests/ordered_list_item_prefix_ordered_style.rb +1 -0
  52. data/test/rule_tests/spaces_after_list_marker_style.rb +1 -0
  53. data/test/rule_tests/trailing_spaces_br_style.rb +1 -0
  54. data/test/test_cli.rb +205 -0
  55. data/test/test_ruledocs.rb +8 -1
  56. data/test/test_rules.rb +4 -2
  57. metadata +55 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bbddcf751f5ec8a6e7a2d184820c2ba747baa0c
4
- data.tar.gz: 6a40d8e63ef5829c7177d5998dbd0363abae8eaa
3
+ metadata.gz: 63d2a62f680a2090a8fdd92a69b01953781e153c
4
+ data.tar.gz: 89d7e3211a085c922f6622fc43920cf424945445
5
5
  SHA512:
6
- metadata.gz: 4cb2592afd5b65dbe4bce8aa980ebfca2b9bb76c2d6d9deff09220375d53305706963a9ceb0d4582ac138dcb4bf2a380d792272cf704152a054c76f5859ad082
7
- data.tar.gz: 82b4dd7b7b81e1ed956e3c39a6ee3a9e6e09deaeb96eeae6278860a69625d53c7ec269944d5db21cadbd7b639a8295cfde4f8540e4eff171cb03d6658f7d3212
6
+ metadata.gz: c0d2dde537e878235680efccb4133a18d25e9f8bce41a926376794d71de4ae2630f4f1f1b0c11574a350b0e672595c7c90f690e5fc01ae3b0279b5c68ee82ff5
7
+ data.tar.gz: 4228d4d9b6387d2d161cab1f5d1ce49dc9d1e6443da0353a4c630f6720cd6359650e50f08d21d40655821a89201308b8592aeb2bd0f6724b0090a815ec4f8c57
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - "1.9.2"
4
- - "1.9.3"
5
4
  - "2.1.0"
6
- - "2.1.1"
5
+ - "2.1.6"
6
+ - "2.3.0"
7
7
  - jruby-19mode # JRuby in 1.9 mode
@@ -1,5 +1,50 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.3.0](https://github.com/mivok/markdownlint/tree/v0.3.0) (2016-03-19)
4
+
5
+ [Full Changelog](https://github.com/mivok/markdownlint/compare/v0.2.1...v0.3.0)
6
+
7
+ ### Rules added/changed
8
+
9
+ * MD041 - First line in file should be a top level header
10
+ * MD003 - An additional header style, setext_with_atx, was added to require
11
+ setext style headers for levels 1 and 2, but allow atx style headers for
12
+ levels 3 and above (i.e. header levels that can't be expressed with setext
13
+ style headers)
14
+ * MD013 - You now have the option to exclude code blocks and tables from the
15
+ line length limit check.
16
+
17
+ ### Enhancements implemented
18
+
19
+ * You can now load your own custom rules with the `-u` option. See
20
+ [rules.rb](https://github.com/mivok/markdownlint/blob/master/lib/mdl/rules.rb)
21
+ for an example of what a rules file looks like. Use the `-d` option if you
22
+ don't want to load markdownlint's default ruleset.
23
+ * You can now refer to rules by human-readable/writable aliases, such as
24
+ 'ul-style' instead of 'MD004'. See RULES.md for a list of the rule aliases.
25
+ You can pass the `-a` option to display rule aliases instead of MDxxx rule
26
+ IDs.
27
+
28
+ ### Bugs fixed
29
+
30
+ * Crash with MD034 and pipe character (#93, #97)
31
+ * MD031 failed on nested code blocks (#100, #109)
32
+ * MD037 crashes on <li> with underscores (#83)
33
+ * Regression introducted in v0.2.1 - ignoring rules/tags on the command line
34
+ caused a crash (#108)
35
+ * MD027 false positive when line starts with a backtick (#105)
36
+
37
+ ### Merged pull requests
38
+
39
+ * [Add support for nested code fences to MD031/MD032 - David
40
+ Anson](https://github.com/mivok/markdownlint/pull/109)
41
+ * [Add missing word to description of MD035 in RULES.md - David
42
+ Anson](https://github.com/mivok/markdownlint/pull/86)
43
+ * [Probe for .mdlrc in current and parent directories - Loic
44
+ Nageleisen](https://github.com/mivok/markdownlint/pull/111)
45
+ * [MD013: allow excluding code blocks and tables - Loic
46
+ Nageleisen](https://github.com/mivok/markdownlint/pull/112)
47
+
3
48
  ## [v0.2.1](https://github.com/mivok/markdownlint/tree/v0.2.1) (2015-04-13)
4
49
 
5
50
  [Full Changelog](https://github.com/mivok/markdownlint/compare/v0.2.0...v0.2.1)
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Issues on deck](https://badge.waffle.io/mivok/markdownlint.png?label=on%20deck&title=On%20Deck)](https://waffle.io/mivok/markdownlint)
2
2
  [![Travis build status](http://api.travis-ci.org/mivok/markdownlint.svg)](https://travis-ci.org/mivok/markdownlint)
3
+ [![Gem Version](https://badge.fury.io/rb/mdl.svg)](http://badge.fury.io/rb/mdl)
3
4
 
4
5
  # Markdown lint tool
5
6
 
@@ -8,6 +8,8 @@ versions of the examples.
8
8
 
9
9
  Tags: headers
10
10
 
11
+ Aliases: header-increment
12
+
11
13
  This rule is triggered when you skip header levels in a markdown document, for
12
14
  example:
13
15
 
@@ -37,6 +39,8 @@ level at a time:
37
39
 
38
40
  Tags: headers
39
41
 
42
+ Aliases: first-header-h1
43
+
40
44
  This rule is triggered when the first header in the document isn't a h1 header:
41
45
 
42
46
  ## This isn't a H1 header
@@ -53,7 +57,9 @@ The first header in the document should be a h1 header:
53
57
 
54
58
  Tags: headers
55
59
 
56
- Parameters: style ("consistent", "atx", "atx_closed", "setext"; default "consistent")
60
+ Aliases: header-style
61
+
62
+ Parameters: style ("consistent", "atx", "atx_closed", "setext", "setext_with_atx"; default "consistent")
57
63
 
58
64
  This rule is triggered when different header styles (atx, setext, and 'closed'
59
65
  atx) are used in the same document:
@@ -71,14 +77,27 @@ Be consistent with the style of header used in a document:
71
77
 
72
78
  ## ATX style H2
73
79
 
80
+ The setext_with_atx doc style allows atx-style headers of level 3 or more in
81
+ documents with setext style headers:
82
+
83
+ Setext style H1
84
+ ===============
85
+
86
+ Setext style H2
87
+ ---------------
88
+
89
+ ### ATX style H3
90
+
74
91
  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.
92
+ atx_closed, setext, setext_with_atx), or simply require that the usage be
93
+ consistent within the document.
77
94
 
78
95
  ## MD004 - Unordered list style
79
96
 
80
97
  Tags: bullet, ul
81
98
 
99
+ Aliases: ul-style
100
+
82
101
  Parameters: style ("consistent", "asterisk", "plus", "dash"; default "consistent")
83
102
 
84
103
  This rule is triggered when the symbols used in the document for unordered
@@ -103,6 +122,8 @@ document.
103
122
 
104
123
  Tags: bullet, ul, indentation
105
124
 
125
+ Aliases: list-indent
126
+
106
127
  This rule is triggered when list items are parsed as being at the same level,
107
128
  but don't have the same indentation:
108
129
 
@@ -123,6 +144,8 @@ for the list to fix it:
123
144
 
124
145
  Tags: bullet, ul, indentation
125
146
 
147
+ Aliases: ul-start-left
148
+
126
149
  This rule is triggered when top level lists don't start at the beginning of a
127
150
  line:
128
151
 
@@ -149,6 +172,8 @@ characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
149
172
 
150
173
  Tags: bullet, ul, indentation
151
174
 
175
+ Aliases: ul-indent
176
+
152
177
  Parameters: indent (number; default 2)
153
178
 
154
179
  This rule is triggered when list items are not indented by the configured
@@ -182,6 +207,8 @@ for a description of the problem.
182
207
 
183
208
  Tags: whitespace
184
209
 
210
+ Aliases: no-trailing-spaces
211
+
185
212
  Parameters: br_spaces (number; default: 0)
186
213
 
187
214
  This rule is triggered on any lines that end with whitespace. To fix this,
@@ -200,6 +227,8 @@ set to the default of 0.
200
227
 
201
228
  Tags: whitespace, hard_tab
202
229
 
230
+ Aliases: no-hard-tabs
231
+
203
232
  This rule is triggered by any lines that contain hard tab characters instead
204
233
  of using spaces for indentation. To fix this, replace any hard tab characters
205
234
  with spaces instead.
@@ -220,6 +249,8 @@ Corrected example:
220
249
 
221
250
  Tags: links
222
251
 
252
+ Aliases: no-reversed-links
253
+
223
254
  This rule is triggered when text that appears to be a link is encountered, but
224
255
  where the syntax appears to have been reversed (the `[]` and `()` are
225
256
  reversed):
@@ -234,6 +265,8 @@ To fix this, swap the `[]` and `()` around:
234
265
 
235
266
  Tags: whitespace, blank_lines
236
267
 
268
+ Aliases: no-multiple-blanks
269
+
237
270
  This rule is triggered when there are multiple consecutive blank lines in the
238
271
  document:
239
272
 
@@ -255,7 +288,8 @@ lines inside code blocks.
255
288
 
256
289
  Tags: line_length
257
290
 
258
- Parameters: line_length (number; default 80)
291
+ Aliases: line-length
292
+ Parameters: line_length, code_blocks, tables (number; default 80, boolean; default true)
259
293
 
260
294
  This rule is triggered when there are lines that are longer than the
261
295
  configured line length (default: 80 characters). To fix this, split the line
@@ -265,10 +299,19 @@ This rule has an exception where there is no whitespace beyond the configured
265
299
  line length. This allows you to still include items such as long URLs without
266
300
  being forced to break them in the middle.
267
301
 
302
+ You also have the option to exclude this rule for code blocks and tables. To
303
+ do this, set the `code_blocks` and/or `tables` parameters to false.
304
+
305
+ Code blocks are included in this rule by default since it is often a
306
+ requirement for document readability, and tentatively compatible with code
307
+ rules. Still, some languages do not lend themselves to short lines.
308
+
268
309
  ## MD014 - Dollar signs used before commands without showing output
269
310
 
270
311
  Tags: code
271
312
 
313
+ Aliases: commands-show-output
314
+
272
315
  This rule is triggered when there are code blocks showing shell commands to be
273
316
  typed, and the shell commands are preceded by dollar signs ($):
274
317
 
@@ -302,6 +345,8 @@ for more information.
302
345
 
303
346
  Tags: headers, atx, spaces
304
347
 
348
+ Aliases: no-missing-space-atx
349
+
305
350
  This rule is triggered when spaces are missing after the hash characters
306
351
  in an atx style header:
307
352
 
@@ -320,6 +365,8 @@ space:
320
365
 
321
366
  Tags: headers, atx, spaces
322
367
 
368
+ Aliases: no-multiple-space-atx
369
+
323
370
  This rule is triggered when more than one space is used to separate the
324
371
  header text from the hash characters in an atx style header:
325
372
 
@@ -338,6 +385,8 @@ space:
338
385
 
339
386
  Tags: headers, atx_closed, spaces
340
387
 
388
+ Aliases: no-missing-space-closed-atx
389
+
341
390
  This rule is triggered when spaces are missing inside the hash characters
342
391
  in a closed atx style header:
343
392
 
@@ -358,6 +407,8 @@ Note: this rule will fire if either side of the header is missing spaces.
358
407
 
359
408
  Tags: headers, atx_closed, spaces
360
409
 
410
+ Aliases: no-multiple-space-closed-atx
411
+
361
412
  This rule is triggered when more than one space is used to separate the
362
413
  header text from the hash characters in a closed atx style header:
363
414
 
@@ -379,6 +430,8 @@ spaces.
379
430
 
380
431
  Tags: headers, blank_lines
381
432
 
433
+ Aliases: blanks-around-headers
434
+
382
435
  This rule is triggered when headers (any style) are either not preceded or not
383
436
  followed by a blank line:
384
437
 
@@ -407,6 +460,8 @@ regular text.
407
460
 
408
461
  Tags: headers, spaces
409
462
 
463
+ Aliases: header-start-left
464
+
410
465
  This rule is triggered when a header is indented by one or more spaces:
411
466
 
412
467
  Some text
@@ -426,6 +481,8 @@ parsed as headers, and will instead appear as regular text.
426
481
 
427
482
  Tags: headers
428
483
 
484
+ Aliases: no-duplicate-header
485
+
429
486
  This rule is triggered if there are multiple headers in the document that have
430
487
  the same text:
431
488
 
@@ -447,6 +504,8 @@ this.
447
504
 
448
505
  Tags: headers
449
506
 
507
+ Aliases: single-h1
508
+
450
509
  This rule is triggered when a top level header is in use (the first line of
451
510
  the file is a h1 header), and more than one h1 header is in use in the
452
511
  document:
@@ -474,6 +533,8 @@ should be contained within this header.
474
533
 
475
534
  Tags: headers
476
535
 
536
+ Aliases: no-trailing-punctuation
537
+
477
538
  Parameters: punctuation (string; default ".,;:!?")
478
539
 
479
540
  This rule is triggered on any header that has a punctuation character as the
@@ -494,6 +555,8 @@ in an FAQ.
494
555
 
495
556
  Tags: blockquote, whitespace, indentation
496
557
 
558
+ Aliases: no-multiple-space-blockquote
559
+
497
560
  This rule is triggered when blockquotes have more than one space after the
498
561
  blockquote (`>`) symbol:
499
562
 
@@ -509,6 +572,8 @@ To fix, remove any extraneous space:
509
572
 
510
573
  Tags: blockquote, whitespace
511
574
 
575
+ Aliases: no-blanks-blockquote
576
+
512
577
  This rule is triggered when two blockquote blocks are separated by nothing
513
578
  except for a blank line:
514
579
 
@@ -542,6 +607,8 @@ separate blockquotes.
542
607
 
543
608
  Tags: ol
544
609
 
610
+ Aliases: ol-prefix
611
+
545
612
  Parameters: style ("one", "ordered"; default "one")
546
613
 
547
614
  This rule is triggered on ordered lists that do not either start with '1.' or
@@ -564,6 +631,8 @@ Example valid list if the style is configured as 'ordered':
564
631
 
565
632
  Tags: ol, ul, whitespace
566
633
 
634
+ Aliases: list-marker-space
635
+
567
636
  Parameters: ul_single, ol_single, ul_multi, ol_multi (number, default 1)
568
637
 
569
638
  This rule checks for the number of spaces between a list marker (e.g. '`-`',
@@ -623,6 +692,8 @@ for your selected document style.
623
692
 
624
693
  Tags: code, blank_lines
625
694
 
695
+ Aliases: blanks-around-fences
696
+
626
697
  This rule is triggered when fenced code blocks are either not preceded or not
627
698
  followed by a blank line:
628
699
 
@@ -658,6 +729,8 @@ not parse fenced code blocks that don't have blank lines before and after them.
658
729
 
659
730
  Tags: bullet, ul, ol, blank_lines
660
731
 
732
+ Aliases: blanks-around-lists
733
+
661
734
  This rule is triggered when lists (of any kind) are either not preceded or not
662
735
  followed by a blank line:
663
736
 
@@ -698,6 +771,8 @@ items with hanging indents are okay:
698
771
 
699
772
  Tags: html
700
773
 
774
+ Aliases: no-inline-html
775
+
701
776
  This rule is triggered whenever raw HTML is used in a markdown document:
702
777
 
703
778
  <h1>Inline HTML header</h1>
@@ -714,6 +789,8 @@ who are rendering markdown documents in something other than HTML.
714
789
 
715
790
  Tags: links, url
716
791
 
792
+ Aliases: no-bare-urls
793
+
717
794
  This rule is triggered whenever a URL is given that isn't surrounded by angle
718
795
  brackets:
719
796
 
@@ -736,11 +813,13 @@ converted:
736
813
 
737
814
  Tags: hr
738
815
 
816
+ Aliases: hr-style
817
+
739
818
  Parameters: style ("consistent", "---", "***", or other string specifying the
740
819
  horizontal rule; default "consistent")
741
820
 
742
- This rule is triggered when inconsistent styles of horizontal rules used in
743
- the document:
821
+ This rule is triggered when inconsistent styles of horizontal rules are used
822
+ in the document:
744
823
 
745
824
  ---
746
825
 
@@ -770,6 +849,8 @@ is allowed.
770
849
 
771
850
  Tags: headers, emphasis
772
851
 
852
+ Aliases: no-emphasis-as-header
853
+
773
854
  This check looks for instances where emphasized (i.e. bold or italic) text is
774
855
  used to separate sections, where a header should be used instead:
775
856
 
@@ -799,6 +880,8 @@ It won't fire on emphasis used within regular text.
799
880
 
800
881
  Tags: whitespace, emphasis
801
882
 
883
+ Aliases: no-space-in-emphasis
884
+
802
885
  This rule is triggered when emphasis markers (bold, italic) are used, but they
803
886
  have spaces between the markers and the text:
804
887
 
@@ -829,6 +912,8 @@ intended by the author.
829
912
 
830
913
  Tags: whitespace, code
831
914
 
915
+ Aliases: no-space-in-code
916
+
832
917
  This rule is triggered on code span elements that have spaces right inside the
833
918
  backticks:
834
919
 
@@ -846,6 +931,8 @@ To fix this, remove the spaces inside the codespan markers:
846
931
 
847
932
  Tags: whitespace, links
848
933
 
934
+ Aliases: no-space-in-links
935
+
849
936
  This rule is triggered on links that have spaces surrounding the link text:
850
937
 
851
938
  [ a link ](http://www.example.com/)
@@ -858,6 +945,8 @@ To fix this, remove the spaces surrounding the link text:
858
945
 
859
946
  Tags: code, language
860
947
 
948
+ Aliases: fenced-code-language
949
+
861
950
  This rule is triggered when fenced code blocks are used, but a language isn't
862
951
  specified:
863
952
 
@@ -872,3 +961,24 @@ To fix this, add a language specifier to the code block:
872
961
  #!/bin/bash
873
962
  echo Hello world
874
963
  ```
964
+
965
+ ## MD041 - First line in file should be a top level header
966
+
967
+ Tags: headers
968
+
969
+ Aliases: first-line-h1
970
+
971
+ This rule is triggered when the first line in the file isn't a top level (h1)
972
+ header:
973
+
974
+ ```
975
+ This is a file without a header
976
+ ```
977
+
978
+ To fix this, add a header to the top of your file:
979
+
980
+ ```
981
+ # File with header
982
+
983
+ This is a file with a top level header
984
+ ```