markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

HTML checking in MD docs

Open countofsanfrancisco opened this issue 6 years ago • 4 comments

This is an enhancement request.

It would be nice to have basic html syntax checking. It would be nice if this tool can also check links (internal or external). However, internal links is more important for me.

countofsanfrancisco avatar Oct 25 '19 17:10 countofsanfrancisco

HTML in Markdown is somewhat discouraged, as by MD033: https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md033

What did you have in mind?

Regarding link checking, that is probably covered by some combination of #40, #68, #121, #144, #213.

DavidAnson avatar Oct 25 '19 17:10 DavidAnson

According to that rules, we can disable it or allow specific elements. MD is great but it doesn't cover some needed complexities inside of tables or in creating anchors. Things that are needed when you convert the MD to a full HTML and include things like table of contents, etc... I found using tags like <p>, <br> and <a> in side of MD tables greatly help make the HTML readable. In very rare cases we need to resort to

because MD can't "merge" cells.

Long story short, for the HTML, the most common problem is forgetting the equivalent end tag. For example, if I wrote this:

<p id="an_anchor_point">

It would be nice to check that there is an end tag (i.e. </p>) and the id is wrapped in quotation double quotation marks. If not, call out an error.

We have multiple editors to the document and simple human mistakes occur.

I don't think you really need to go any further than that if you don't want.

countofsanfrancisco avatar Oct 25 '19 17:10 countofsanfrancisco

Makes sense, thanks!

DavidAnson avatar Oct 25 '19 17:10 DavidAnson

You'd better enhance webhint or some other HTML linter, or use Markdown preprocessor such as mdBook that allows you to include other files as fragments, and split out the HTML source code.

sanmai-NL avatar Nov 20 '20 10:11 sanmai-NL