-
Notifications
You must be signed in to change notification settings - Fork 123
markdown linter #1356
Comments
Let linting specialize in detecting things that are mistakes, and leave all style related things to formatting. Remark-stringify formats a parsed markdown tree, but it could be improved by giving it more options. If your markdown comes out of a formatter that is always on, or works on save, suddenly those nitty-gritty details of how you want your markdown lose their importance. No matter how somebody else has writen the markdown, if you are going to interact with it, your formatter brings it in your style, you do your thing, and leave it like that. The next one does the same. No need to agree on formats anymore. And the readers of the actual content, for them it is moot anyway, because they look at the HTML. |
Thanks for the tips! Yes, linting actually implies searching for problematic parts. The idea to reformat everything according to some style came from our experience with clang-format which decides on all formating problems good enough so that humans do not have to care about formatting anymore. Seems like we are not there yet for Markdown?
Doesn't this clutter the commit history with formatting changes? More concrete tips which linter to use and how to configure it are very welcomed. |
Ah, the commit histories ... |
@sanssecours Is this resolved by #2422? |
Most of the points above should be resolved. The only thing left is probably:
. Ignoring certain parts of a Markdown file should be possible using <!-- prettier-ignore --> . |
Thank you! Could you please update the docu in doc/CODING.md (Markdown Section) to reflect that? |
As suggested by @Namoshek we should use a markdown linter to automatically reformat markdown code.
In #1339 he said: "Maybe a linter (or another one) could help? Involves installing npm on the corresponding build-agents though."
In #1034 he said: "Searching for markdown formatters/validators isn't all that viable, but I found remark (nodejs based), which can reformat markdown files to a format that is widely accepted by many doc generators, etc. There are also plugins like remark-lint, which can be configured to throw warnings on style mistakes, but it seems that remark-lint is not (yet) able to fix style issues."
Work already done
(copied from #1339)
With my special configuration that enforces quite a lot of stuff (e.g. same list character everywhere, equal indentations, atx-closed headers, blablabla...), it was about 4200 warnings for all markdown files together. After formatting with
remark
, the warnings increased to about 4900. So my desired still is quite apart from the remark default.Not sure if most/any of the settings are clear from their name, but that's what I used:
If a setting is set to
true
, it normally means there is a check that warns if a situation described by the setting was found. E.g.no-heading-indent
will warn if it finds something like___## Blub
(underscore symbolizes a space) because of the leading space.We certainly can, we only have to reformat the docu once. Running
remark . --output
in the repo root will fix all issues, but we can't really specify our desired format. The created format looks ok though (gist with three reformatted plugin READMEs, I don't think there is a difference in the parsed output on github, but the raw format is different (e.g. headlines, enumerations)).Missing Work
Discussion
The text was updated successfully, but these errors were encountered: