mdl 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38b73db54b5ec02a8b079558f3cb444c3f29e7ffd0e9a752483115d5c0a13a93
4
- data.tar.gz: 47c88efb0b9aa6ac538c769096d02d36170109ef4a7bc9e4370af8d45143c6d0
3
+ metadata.gz: 7ccf964a726aadad1ea7bdc7e589852b27172ebe7dc0931915edde1cfe55376c
4
+ data.tar.gz: 246846b368b1be17d82de807042ac754b6cca2bc9420a97bf9dbcf2115d44384
5
5
  SHA512:
6
- metadata.gz: 3a9c8c520e4f1e31517bb4b34549e45c505f86ed84daff6548092df02a34b594a7b81a8c4972ea93ba14fd75d4ea8a753e5c8f6f67994857d3e55449fbeb55bf
7
- data.tar.gz: a8b3d72b3ff83bd86eb72c3b3911d16a5951ebc26372fa40995662f9372931aa192948517eafb7d7a8ec3eb0ede0d226423754c60c037543d7d55023d55f801f
6
+ metadata.gz: 15e0c6a011500d284f0418090c3a2c57f53f2d0a5d281dadc87b86ee345d90ac9686513ef2a58aa5f21a47b2e710474a18404216a6658ce7f4f0a76fe4dd6f8e
7
+ data.tar.gz: a67b0882f1f05600a21466d4f8a11dda875cf46e045f7e6e663a7d2834f44c7ab101ac4328017da85c74f370b914bd9f49ce65183a3174fcece1d2335f886aec
@@ -0,0 +1,6 @@
1
+ - id: markdownlint
2
+ name: Markdownlint
3
+ description: Run markdownlint on your Markdown files
4
+ entry: mdl
5
+ language: ruby
6
+ files: \.(md|mdown|markdown)$
@@ -1,23 +1,12 @@
1
- sudo: false
2
- dist: trusty
1
+ dist: bionic
3
2
  language: ruby
4
3
 
5
4
  notifications:
6
5
  email: false
7
6
 
8
- # Temporary disable of jruby testing. There are problems on travis-ci
9
- # currently with this. See:
10
- #
11
- # https://github.com/travis-ci/travis-ci/issues/9826
12
- #
13
- # before_install:
14
- # - unset _JAVA_OPTIONS
15
-
16
7
  matrix:
17
8
  include:
18
- - rvm: 2.3.4
19
- - rvm: 2.4.1
20
- - rvm: 2.5.1
21
- # - rvm: jruby-9.1.9.0
22
- # env: JRUBY_OPTS="--dev"
23
- # - rvm: jruby-9.2.0.0
9
+ - rvm: 2.4.6
10
+ - rvm: 2.5.5
11
+ - rvm: 2.6.2
12
+ - rvm: jruby-9.2.8.0
@@ -1,10 +1,29 @@
1
1
  # Change Log
2
2
 
3
- ## [Unreleased]
3
+ ## [v0.6.0] (2019-10-19)
4
+
5
+ ### Added
6
+
7
+ * There are now CONTRIBUTING.md and MAINTAINERS.md docs
8
+ * There is now a `.pre-commit-hooks.yaml` for those who want to use pre-commit.com
4
9
 
5
10
  ### Changed
6
11
 
7
- ## [v0.5.0]
12
+ * PR #248: Ignore blank line after front matter
13
+ * PR #231: Only import JSON when necessary (#223)
14
+ * PR #265: Use newere mixlib-cli
15
+ * PR #246: Nicer error message when activating nonexistent rule
16
+ * PR #241: Fix documentation on `ignore_front_matter`
17
+ * PR #245: Update docs to use "MY" prefix for custom rule example
18
+ * PR #256: Fix crash in MD039 when the link text is empty
19
+ * PR #229: Reference Node.js markdownlint
20
+ * PR #232: Added table of contents to RULES.md for easier navigation
21
+ * PR #219: Fix typos in MD046 docs
22
+ * PR #222: Fixed MD036 crash
23
+
24
+ ### Removed
25
+
26
+ ## [v0.5.0] (2018-07-01)
8
27
 
9
28
  ### Added
10
29
 
@@ -178,6 +197,8 @@
178
197
  * MD030 - Spaces after list markers
179
198
 
180
199
  [Unreleased]: https://github.com/markdownlint/markdownlint/tree/master
200
+ [v0.6.0]: https://github.com/markdownlint/markdownlint/tree/v0.6.0
201
+ [v0.5.0]: https://github.com/markdownlint/markdownlint/tree/v0.5.0
181
202
  [v0.4.0]: https://github.com/markdownlint/markdownlint/tree/v0.4.0
182
203
  [v0.3.1]: https://github.com/markdownlint/markdownlint/tree/v0.3.1
183
204
  [v0.3.0]: https://github.com/markdownlint/markdownlint/tree/v0.3.0
@@ -0,0 +1,7 @@
1
+ # Contributing
2
+
3
+ 1. Fork it ( <http://github.com/markdownlint/markdownlint/fork> )
4
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
5
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
6
+ 1. Push to the branch (`git push origin my-new-feature`)
7
+ 1. Create new Pull Request
@@ -0,0 +1,21 @@
1
+ # Markdownlint
2
+
3
+ We aim to make sure this project has longevity, and to that end we want to make
4
+ adding new maintainers a simple process.
5
+
6
+ If you would like to be a maintainer, you need to demonstrate some ongoing
7
+ contributions - either reviews of PRs or PR contributions. They need not be large.
8
+ Then send a PR to add yourself to this list. The existing maintainers will
9
+ have a discussion, and assuming there are no objections, you'll be added.
10
+
11
+ ## Current Maintainers
12
+
13
+ * [Phil Dibowitz](https://github.com/jaymzh)
14
+ * [Naomi Reeves](https://github.com/NaomiReeves)
15
+ * [Bryan Wann](https://github.com/bwann)
16
+ * [David Anson](https://github.com/DavidAnson)
17
+
18
+ ## Past Maintainers
19
+
20
+ * [psyomn](https://github.com/psyomn)
21
+ * [Mark Harrison](https://github.com/mivok)
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
- [![Issues on deck](https://badge.waffle.io/mivok/markdownlint.png?label=on%20deck&title=On%20Deck)](https://waffle.io/mivok/markdownlint)
2
1
  [![Travis build status](http://api.travis-ci.org/markdownlint/markdownlint.svg)](https://travis-ci.org/markdownlint/markdownlint)
3
2
  [![Gem Version](https://badge.fury.io/rb/mdl.svg)](http://badge.fury.io/rb/mdl)
4
3
 
@@ -77,10 +76,12 @@ configured in a style file.
77
76
  For more information on creating style files, see the
78
77
  [creating styles](docs/creating_styles.md) document.
79
78
 
79
+ ## Related projects
80
+
81
+ - [markdownlint](https://github.com/DavidAnson/markdownlint) and
82
+ [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) for
83
+ Node.js
84
+
80
85
  ## Contributing
81
86
 
82
- 1. Fork it ( <http://github.com/markdownlint/markdownlint/fork> )
83
- 1. Create your feature branch (`git checkout -b my-new-feature`)
84
- 1. Commit your changes (`git commit -am 'Add some feature'`)
85
- 1. Push to the branch (`git push origin my-new-feature`)
86
- 1. Create new Pull Request
87
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
@@ -1,3 +1,44 @@
1
+
2
+ * [Rules](#rules)
3
+ * [MD001 - Header levels should only increment by one level at a time](#md001---header-levels-should-only-increment-by-one-level-at-a-time)
4
+ * [MD002 - First header should be a top level header](#md002---first-header-should-be-a-top-level-header)
5
+ * [MD003 - Header style](#md003---header-style)
6
+ * [MD004 - Unordered list style](#md004---unordered-list-style)
7
+ * [MD005 - Inconsistent indentation for list items at the same level](#md005---inconsistent-indentation-for-list-items-at-the-same-level)
8
+ * [MD006 - Consider starting bulleted lists at the beginning of the line](#md006---consider-starting-bulleted-lists-at-the-beginning-of-the-line)
9
+ * [MD007 - Unordered list indentation](#md007---unordered-list-indentation)
10
+ * [MD009 - Trailing spaces](#md009---trailing-spaces)
11
+ * [MD010 - Hard tabs](#md010---hard-tabs)
12
+ * [MD011 - Reversed link syntax](#md011---reversed-link-syntax)
13
+ * [MD012 - Multiple consecutive blank lines](#md012---multiple-consecutive-blank-lines)
14
+ * [MD013 - Line length](#md013---line-length)
15
+ * [MD014 - Dollar signs used before commands without showing output](#md014---dollar-signs-used-before-commands-without-showing-output)
16
+ * [MD018 - No space after hash on atx style header](#md018---no-space-after-hash-on-atx-style-header)
17
+ * [MD019 - Multiple spaces after hash on atx style header](#md019---multiple-spaces-after-hash-on-atx-style-header)
18
+ * [MD020 - No space inside hashes on closed atx style header](#md020---no-space-inside-hashes-on-closed-atx-style-header)
19
+ * [MD021 - Multiple spaces inside hashes on closed atx style header](#md021---multiple-spaces-inside-hashes-on-closed-atx-style-header)
20
+ * [MD022 - Headers should be surrounded by blank lines](#md022---headers-should-be-surrounded-by-blank-lines)
21
+ * [MD023 - Headers must start at the beginning of the line](#md023---headers-must-start-at-the-beginning-of-the-line)
22
+ * [MD024 - Multiple headers with the same content](#md024---multiple-headers-with-the-same-content)
23
+ * [MD025 - Multiple top level headers in the same document](#md025---multiple-top-level-headers-in-the-same-document)
24
+ * [MD026 - Trailing punctuation in header](#md026---trailing-punctuation-in-header)
25
+ * [MD027 - Multiple spaces after blockquote symbol](#md027---multiple-spaces-after-blockquote-symbol)
26
+ * [MD028 - Blank line inside blockquote](#md028---blank-line-inside-blockquote)
27
+ * [MD029 - Ordered list item prefix](#md029---ordered-list-item-prefix)
28
+ * [MD030 - Spaces after list markers](#md030---spaces-after-list-markers)
29
+ * [MD031 - Fenced code blocks should be surrounded by blank lines](#md031---fenced-code-blocks-should-be-surrounded-by-blank-lines)
30
+ * [MD032 - Lists should be surrounded by blank lines](#md032---lists-should-be-surrounded-by-blank-lines)
31
+ * [MD033 - Inline HTML](#md033---inline-html)
32
+ * [MD034 - Bare URL used](#md034---bare-url-used)
33
+ * [MD035 - Horizontal rule style](#md035---horizontal-rule-style)
34
+ * [MD036 - Emphasis used instead of a header](#md036---emphasis-used-instead-of-a-header)
35
+ * [MD037 - Spaces inside emphasis markers](#md037---spaces-inside-emphasis-markers)
36
+ * [MD038 - Spaces inside code span elements](#md038---spaces-inside-code-span-elements)
37
+ * [MD039 - Spaces inside link text](#md039---spaces-inside-link-text)
38
+ * [MD040 - Fenced code blocks should have a language specified](#md040---fenced-code-blocks-should-have-a-language-specified)
39
+ * [MD041 - First line in file should be a top level header](#md041---first-line-in-file-should-be-a-top-level-header)
40
+ * [MD046 - Code block style](#md046---code-block-style)
41
+
1
42
  # Rules
2
43
 
3
44
  This document contains a description of all rules, what they are checking for,
@@ -1025,8 +1066,9 @@ Aliases: code-block-style
1025
1066
 
1026
1067
  Parameters: style ("fenced", "indented", "consistent", default "fenced")
1027
1068
 
1028
- This rule is truggered what a different code block style is used than the
1029
- configured one. For example, in the default configuration this triggers:
1069
+ This rule is triggered when a different code block style is used than the
1070
+ configured one. For example, in the default configuration this rule is triggered
1071
+ for the following document:
1030
1072
 
1031
1073
  Some text.
1032
1074
 
@@ -1044,4 +1086,4 @@ To fix this, used fenced code blocks:
1044
1086
 
1045
1087
  Some more text.
1046
1088
 
1047
- Or the reverse for the `indented` style.
1089
+ The reverse is true if the rule is configured to use the `indented` style.
@@ -46,7 +46,7 @@ numbers will still match the file contents but markdownlint will consider the
46
46
  line following front matter to be the first line.
47
47
 
48
48
  * Command line: `-i`, `--ignore-front-matter`
49
- * Config file: `ignore-front-matter true`
49
+ * Config file: `ignore_front_matter true`
50
50
  * Default: false
51
51
 
52
52
  ### Specifying which rules mdl processes
@@ -3,7 +3,7 @@
3
3
  Rules are written in ruby, using a rule DSL for defining rules. A rule looks
4
4
  like:
5
5
 
6
- rule "MD000", "Rule description" do
6
+ rule "MY000", "Rule description" do
7
7
  tags :foo, :bar
8
8
  aliases 'rule-name'
9
9
  params :style => :foo
data/lib/mdl.rb CHANGED
@@ -6,7 +6,6 @@ require 'mdl/ruleset'
6
6
  require 'mdl/style'
7
7
  require 'mdl/version'
8
8
 
9
- require 'json'
10
9
  require 'kramdown'
11
10
 
12
11
  module MarkdownLint
@@ -89,6 +88,7 @@ module MarkdownLint
89
88
  error_lines.each do |line|
90
89
  line += doc.offset # Correct line numbers for any yaml front matter
91
90
  if Config[:json]
91
+ require 'json'
92
92
  results << {
93
93
  'filename' => filename,
94
94
  'line' => line,
@@ -34,7 +34,7 @@ module MarkdownLint
34
34
  # Create a new document given a string containing the markdown source
35
35
 
36
36
  def initialize(text, ignore_front_matter = false)
37
- regex = /^---\n(.*?)---\n/m
37
+ regex = /^---\n(.*?)---\n\n?/m
38
38
  if ignore_front_matter and regex.match(text)
39
39
  @offset = regex.match(text).to_s.split("\n").length
40
40
  text.sub!(regex,'')
@@ -585,6 +585,7 @@ rule "MD036", "Emphasis used instead of a header" do
585
585
  next unless [:em, :strong].include?(p.children[0].type)
586
586
  lines = doc.extract_text(p.children[0], "", false)
587
587
  next if lines.length > 1
588
+ next if lines.empty?
588
589
  next if lines[0].match(/[#{params[:punctuation]}]$/)
589
590
  errors << doc.element_linenumber(p)
590
591
  end
@@ -620,10 +621,10 @@ rule "MD039", "Spaces inside link text" do
620
621
  aliases 'no-space-in-links'
621
622
  check do |doc|
622
623
  doc.element_linenumbers(
623
- doc.find_type_elements(:a).select{|e|
624
- e.children[0].type == :text and (
625
- e.children.first.value.start_with?(" ") or
626
- e.children.last.value.end_with?(" "))}
624
+ doc.find_type_elements(:a).reject{|e|e.children.empty?}.select{|e|
625
+ e.children.first.type == :text && e.children.last.type == :text and (
626
+ e.children.first.value.start_with?(" ") or
627
+ e.children.last.value.end_with?(" "))}
627
628
  )
628
629
  end
629
630
  end
@@ -25,7 +25,13 @@ module MarkdownLint
25
25
  end
26
26
 
27
27
  def rule(id, params={})
28
+ if block_given?
29
+ raise "'rule' does not take a block. Should this definition go in a ruleset instead?"
30
+ end
28
31
  id = @aliases[id] if @aliases[id]
32
+ unless @all_rules[id]
33
+ raise "No such rule: #{id}"
34
+ end
29
35
  @rules << id
30
36
  @all_rules[id].params(params)
31
37
  end
@@ -1,3 +1,3 @@
1
1
  module MarkdownLint
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency 'kramdown', '~> 1.12', '>= 1.12.0'
24
24
  spec.add_dependency 'mixlib-config', '~> 2.2', '>= 2.2.1'
25
- spec.add_dependency 'mixlib-cli', '~> 1.7', '>= 1.7.0'
25
+ spec.add_dependency 'mixlib-cli', '~> 2.1', '>= 2.1.1'
26
26
 
27
- spec.add_development_dependency 'bundler', '~> 1.12'
27
+ spec.add_development_dependency 'bundler', '>= 1.12', '< 3'
28
28
  spec.add_development_dependency 'rake', '~> 11.2'
29
29
  spec.add_development_dependency 'minitest', '~> 5.9'
30
30
  spec.add_development_dependency 'pry', '~> 0.10'
@@ -38,3 +38,5 @@ not trigger the rule.
38
38
  detected as a header because it's on multiple lines**
39
39
 
40
40
  **This also shouldn't be detected as a header as it ends in punctuation.**
41
+
42
+ **[This as well since it is a link](https://example.com)**
@@ -1,10 +1,28 @@
1
+ [](http://bar/)
2
+
1
3
  [foo](http://bar/)
2
4
 
5
+ ["foo"](http:/bar/)
6
+
7
+ [`foo`](http://bar/)
8
+
9
+ [*foo*](http://bar/)
10
+
11
+ [**foo**](http://bar/)
12
+
13
+ [foo "bar"](http:/baz/)
14
+
3
15
  [foo ](http://bar/) {MD039}
4
16
 
5
17
  [ foo](http://bar/) {MD039}
6
18
 
7
19
  [ foo ](http://bar/) {MD039}
8
20
 
21
+ [ "foo" ](http://bar/) {MD039}
22
+
23
+ [ `foo` ](http://bar/) {MD039}
24
+
25
+ [ *foo* ](http://bar/) {MD039}
26
+
9
27
  The following shouldn't break anything:
10
28
  [![Screenshot.png](/images/Screenshot.png)](/images/Screenshot.png)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Harrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-01 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -56,34 +56,40 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.7'
59
+ version: '2.1'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 1.7.0
62
+ version: 2.1.1
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.7'
69
+ version: '2.1'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 1.7.0
72
+ version: 2.1.1
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: bundler
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - "~>"
77
+ - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: '1.12'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '3'
80
83
  type: :development
81
84
  prerelease: false
82
85
  version_requirements: !ruby/object:Gem::Requirement
83
86
  requirements:
84
- - - "~>"
87
+ - - ">="
85
88
  - !ruby/object:Gem::Version
86
89
  version: '1.12'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '3'
87
93
  - !ruby/object:Gem::Dependency
88
94
  name: rake
89
95
  requirement: !ruby/object:Gem::Requirement
@@ -135,10 +141,13 @@ extensions: []
135
141
  extra_rdoc_files: []
136
142
  files:
137
143
  - ".gitignore"
144
+ - ".pre-commit-hooks.yaml"
138
145
  - ".travis.yml"
139
146
  - CHANGELOG.md
147
+ - CONTRIBUTING.md
140
148
  - Gemfile
141
149
  - LICENSE.txt
150
+ - MAINTAINERS.md
142
151
  - README.md
143
152
  - Rakefile
144
153
  - bin/mdl
@@ -305,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
314
  version: '0'
306
315
  requirements: []
307
316
  rubyforge_project:
308
- rubygems_version: 2.7.6
317
+ rubygems_version: 2.7.7
309
318
  signing_key:
310
319
  specification_version: 4
311
320
  summary: Markdown lint tool