Unverified Commit 255d3356 authored by Mario Rodas's avatar Mario Rodas Committed by Sebastian Wiesner

Add markdown lint checker

Closes GH-839 and closes GH-916
parent 53dc5ad6
......@@ -4,6 +4,7 @@
- New syntax checkers:
- Go with ``go-unconvert`` [GH-905]
- Markdown with ``mdl`` [GH-839] [GH-916]
26 (Apr 27, 2016)
=================
......
......@@ -29,6 +29,7 @@
(depends-on "json-mode")
(depends-on "less-css-mode")
(depends-on "lua-mode")
(depends-on "markdown-mode")
(depends-on "mmm-mode")
(depends-on "php-mode")
(depends-on "processing-mode")
......
......@@ -583,6 +583,22 @@ to view the docstring of the syntax checker. Likewise, you may use
Check syntax with the `Lua compiler <http://www.lua.org/>`_.
.. supported-language:: Markdown
.. syntax-checker:: markdown-mdl
Check Markdown with `markdownlint <https://github.com/mivok/markdownlint/>`_.
.. option:: flycheck-markdown-mdl-rules
A list of enabled rules.
.. option:: flycheck-markdown-mdl-tags
A list of enabled rule tags.
.. syntax-checker-config-file:: flycheck-markdown-mdl-style
.. supported-language:: Perl
Flycheck checks Perl with `perl` and `perl-perlcritic`.
......
......@@ -226,6 +226,7 @@ attention to case differences."
r-lintr
racket
rpm-rpmlint
markdown-mdl
rst-sphinx
rst
ruby-rubocop
......@@ -7800,6 +7801,56 @@ See URL `https://sourceforge.net/projects/rpmlint/'."
;; In `sh-mode', we need the proper shell
(eq sh-shell 'rpm))))
(flycheck-def-option-var flycheck-markdown-mdl-rules nil markdown-mdl
"Enabled rules for mdl.
The value of this variable is a list of strings, where each
string is the name of an rule to limit. By default, all the
rules are enabled.
See the mdl configuration documentation at URL
`https://github.com/mivok/markdownlint/blob/master/docs/configuration.md'."
:type '(repeat :tag "Enabled rules"
(string :tag "rule name"))
:safe #'flycheck-string-list-p)
(flycheck-def-option-var flycheck-markdown-mdl-tags nil markdown-mdl
"Enabled tag rules for mdl.
The value of this variable is a list of strings, where each
string is the name of an rule to limit. By default, all the tag
rules are enabled.
See the mdl configuration documentation at URL
`https://github.com/mivok/markdownlint/blob/master/docs/configuration.md'."
:type '(repeat :tag "Enabled tags"
(string :tag "tag name"))
:safe #'flycheck-string-list-p)
(flycheck-def-config-file-var flycheck-markdown-mdl-style markdown-mdl nil
:safe #'stringp)
(flycheck-define-checker markdown-mdl
"Markdown checker using mdl.
See URL `https://github.com/mivok/markdownlint'."
:command ("mdl"
(config-file "--style" flycheck-markdown-mdl-style)
(option "--tags=" flycheck-markdown-mdl-rules concat
flycheck-option-comma-separated-list)
(option "--rules=" flycheck-markdown-mdl-rules concat
flycheck-option-comma-separated-list))
:standard-input t
:error-patterns
((error line-start
(file-name) ":" line ": " (id (one-or-more alnum)) " " (message)
line-end))
:error-filter
(lambda (errors)
(flycheck-sanitize-errors
(flycheck-remove-error-file-names "(stdin)" errors)))
:modes (markdown-mode gfm-mode))
(defun flycheck-locate-sphinx-source-directory ()
"Locate the Sphinx source directory for the current buffer.
......
......@@ -4010,6 +4010,11 @@ Why not:
:checker rpm-rpmlint)
'(22 nil warning "macro-in-%changelog %{_bindir}" :checker rpm-rpmlint)))
(flycheck-ert-def-checker-test markdown-mdl markdown nil
(flycheck-ert-should-syntax-check
"language/markdown.md" 'markdown-mode
'(1 nil error "First header should be a h1 header" :id "MD002" :checker markdown-mdl)))
(ert-deftest flycheck-locate-sphinx-source-directory/not-in-a-sphinx-project ()
:tags '(language-rst)
(flycheck-ert-with-resource-buffer "language/rst/errors.rst"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment