docs: add mdl for Markdown linting

Run with `mdl -c docs/.mdlrc docs/*.md`.
This commit is contained in:
EricFromCanada 2021-12-02 13:52:27 -05:00
parent c75aaed831
commit 45bf8b0118
No known key found for this signature in database
GPG Key ID: 179D9CDDDB814168
6 changed files with 41 additions and 2 deletions

7
docs/.mdl_ruleset.rb Normal file
View File

@ -0,0 +1,7 @@
rule 'HB034', 'Bare unstyled URL used' do
tags :links, :url
aliases 'no-bare-unstyled-urls'
check do |doc|
doc.matching_text_element_lines(%r{(?<=\s)https?://})
end
end

7
docs/.mdl_style.rb Normal file
View File

@ -0,0 +1,7 @@
all
rule 'MD026', punctuation: ',;:' # Trailing punctuation in header
exclude_rule 'MD013' # Line length
exclude_rule 'MD029' # Ordered list item prefix
exclude_rule 'MD033' # Inline HTML
exclude_rule 'MD034' # Bare URL used (replaced by HB034)
exclude_rule 'MD046' # Code block style

4
docs/.mdlrc Normal file
View File

@ -0,0 +1,4 @@
git_recurse true
ignore_front_matter true
style "#{File.dirname(__FILE__)}/.mdl_style.rb"
rulesets ["#{File.dirname(__FILE__)}/.mdl_ruleset.rb"]

View File

@ -4,5 +4,6 @@ gem "github-pages", group: :jekyll_plugins
group :test do group :test do
gem "html-proofer" gem "html-proofer"
gem "mdl"
gem "rake" gem "rake"
end end

View File

@ -9,6 +9,8 @@ GEM
zeitwerk (~> 2.2, >= 2.2.2) zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.0) addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
chef-utils (17.8.25)
concurrent-ruby
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
@ -226,6 +228,12 @@ GEM
listen (3.7.0) listen (3.7.0)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
mdl (0.11.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
mixlib-cli (~> 2.1, >= 2.1.1)
mixlib-config (>= 2.2.1, < 4)
mixlib-shellout
mercenary (0.3.6) mercenary (0.3.6)
mini_portile2 (2.6.1) mini_portile2 (2.6.1)
minima (2.5.1) minima (2.5.1)
@ -233,6 +241,11 @@ GEM
jekyll-feed (~> 0.9) jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1) jekyll-seo-tag (~> 2.1)
minitest (5.14.4) minitest (5.14.4)
mixlib-cli (2.1.8)
mixlib-config (3.0.9)
tomlrb
mixlib-shellout (3.2.5)
chef-utils
multipart-post (2.1.1) multipart-post (2.1.1)
nokogiri (1.12.5) nokogiri (1.12.5)
mini_portile2 (~> 2.6.1) mini_portile2 (~> 2.6.1)
@ -272,6 +285,7 @@ GEM
terminal-table (1.8.0) terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tomlrb (2.0.1)
typhoeus (1.4.0) typhoeus (1.4.0)
ethon (>= 0.9.0) ethon (>= 0.9.0)
tzinfo (1.2.9) tzinfo (1.2.9)
@ -289,7 +303,8 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
github-pages github-pages
html-proofer html-proofer
mdl
rake rake
BUNDLED WITH BUNDLED WITH
1.17.2 1.17.3

View File

@ -7,7 +7,12 @@ task :build do
sh "jekyll", "build" sh "jekyll", "build"
end end
desc "Run html proofer to validate the HTML output." desc "Run Markdownlint to validate the Markdown style."
task lint: :build do
sh "mdl", "."
end
desc "Run HTMLProofer to validate the HTML output."
task test: :build do task test: :build do
require "html-proofer" require "html-proofer"
HTMLProofer.check_directory( HTMLProofer.check_directory(