hexojs / hexo-renderer-markdown-it

Markdown-it is a Markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.
MIT License
349 stars 60 forks source link

Cannot process ##Headings #11

Closed Hunter-Github closed 9 years ago

Hunter-Github commented 9 years ago

Default hexo-renderer-marked converts ##Headings to <h2 id="Headings">Headings</h2>

hexo-renderer-markdown-it doesn't replicate this behavior, and has <h2 ...>##Headings... instead.

...with an otherwise unremarkable _config.yml:

 markdown:
     render:
         breaks: false
         html:   true
    plugins:
         - markdown-it-footnote
         - markdown-it-sup
         - markdown-it-sub
celsomiranda commented 9 years ago

My research tells me this comes from upstream. Although I can't tell you if this is a bug, or if it's by design.

If you want, you can open an issue here.

That said. This renderer aims to bring markdown-it support with a few of it's plugins (you can always create a request if you want a specific plugin to be included). It's not the aim of this project to be fully compatible with marked, which adds features that aren't in any spec.

John Grubber's markdown spec and CommonMark define the hash headlines as having a space between the # and the heading text, so as far as I know, that's something that marked maybe shouldn't be doing.

I'm closing this, but I'll re-open if the markdown-it devs change the behaviour of their parser.

Hunter-Github commented 9 years ago

Okay, fine by me. Found the relevant reference in the CommonMark spec: http://spec.commonmark.org/0.18/#atx-headers

celsomiranda commented 9 years ago

Thanks. :+1: