Search code examples
javascripthtmlmarkdowngulpmetalsmith

Why is Markdown rendering <h1> with id's?


I'm using Gulp + Gulpsmith + Metalsmith to create my website.

metalsmith_markdown is rendering my HTML as follows:

# This is an H1 to <h1 id="this-is-an-h1">This is an H1</h1>. Why is it rendering that 'id' tag?

Why might that be?

Here's the part that deals with the markdown rendering in my Gulpfile.js

.use(markdown({
    gfm: true,
    tables: true,
    breaks: false,
    pedantic: false,
    sanitize: true,
    smartLists: true,
    smartypants: true
}))

Solution

  • That's the behavior of metalsmith-markdown which uses marked as Markdown parser since the PR#181.

    You can override some features of marked as stated in their Readme and in #420, but since all is handled by the metalsmith plugin, you can't really.

    I would advice to create a PR in marked to add a custom option to deactivate completely the behavior near this