observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
966 stars 83 forks source link

Request to restore implicit DIV wrapping for md #84

Closed mfila closed 5 years ago

mfila commented 5 years ago

In pull request #80 the implicit wrapping element for html and md tagged template literals was changed from a DIV to a SPAN.

Perhaps for md the old implicit wrapping, using a DIV, is more sensible. At the moment if you apply md to a string with no formatting or only inline formatting, it assumes that the string is a paragraph, so you get back a P, that is a block level element. If you apply it to a string containing only one Markdown "block" (e.g. "# foo bar" or "> foo bar") you get back the corresponding HTML block element (e.g. H1 or BLOCKQUOTE). But when you pass a string containing more than one Markdown block, you get back a SPAN (inline element) wrapping corresponding HTML block elements. In my humble opinion this behavior is not what users would expect.

With html it makes sense to avoid the implicit SPAN by wrapping all content in an explicit DIV. This also works with md, but doing so you'll loose all Markdown block level formatting.

Keep up the good work.

mbostock commented 5 years ago

Agreed—we should use DIV for md. Thanks for the fix!