kivikakk / comrak

CommonMark + GFM compatible Markdown parser and renderer
Other
1.12k stars 133 forks source link

NodeHeading should have a property, indicating ATX closed header #422

Open ekropotin opened 2 weeks ago

ekropotin commented 2 weeks ago

It'd nice if NodeHeading provide an indication either given ATX-style header is closed or not:

# ATX style header

vs

# closed-ATX style header #

Motivation:

I'm working on markdown/commonmark linter, which is being powered by Comrak. The linting rules are being ported from https://github.com/markdownlint/markdownlint. One on the rules should be triggered when inconsistent heading styles are used across a document, for example, when there is a mix of ATX and closed ATX-style headers. To enforce this rule, I need to differentiate between regular ATX headers and closed ATX headers.

kivikakk commented 2 weeks ago

I'd be OK with adding this to Comrak. I should note, though, that in general it aims to provide an AST and not a CST/concrete syntax tree, so you might find a fair few other such things needing to be added to use it for a linter.