tufte-markdown icon indicating copy to clipboard operation
tufte-markdown copied to clipboard

Markdown fragments without Headings render without section

Open eaton opened this issue 5 years ago • 0 comments

Thanks for the great work on this library! I'm in the process of wiring up to the eleventy static site generator as a replacement for the built-in markdown parser, and everything seems to be working well. One hitch, though: Markdown documents with no second-level headings never get the necessary section tag as a wrapper, and the layout files. For example:

console.dir(parse('Opening paragraph\n## Heading **strong** *emphasis*'))

// Output:
// <section><p>Opening paragraph</p></section> <section><h2 id="heading-strong-emphasis">Heading <strong>strong</strong> <em>emphasis</em></h2></section>

console.dir(parse('Opening paragraph\n\nSecond paragraph'))

// Output:
// <p>Opening paragraph</p> <p>Second paragraph</p>

I'm not sure if this is intentional; in theory it's possible to check the output for a missing <section>, but it seems like adding the wrapper makes sense even if there's no second-level heading?

eaton avatar Nov 25 '20 03:11 eaton