jgm / djot

A light markup language
https://djot.net
MIT License
1.62k stars 43 forks source link

The closing delimiter of a div block can interrupt a paragraph #291

Closed rauschma closed 3 months ago

rauschma commented 3 months ago

Markdown:

::: note
line
:::

HTML:

<div class="note">
<p>line</p>
</div>

Playground

Doesn’t this conflict with the rule “Block-level elements can't interrupt paragraphs”?

jgm commented 3 months ago

Not really; this isn't a new block-level element, it's just the end of one that had already been started.

rauschma commented 3 months ago

OK. I’m torn:

jgm commented 3 months ago

Philosophically, I would almost prefer not to have any fenced constructs for this reason.

A side-marked div construct (like blockquotes, but with :) has several advantages: (a) it is local (you don't need to look potentially far back in the file to see if you're in a div), (b) nesting is completely clear, (c) it doesn't have this problem with the end fence, (d) it is more consistent, since the other block containers are non-fenced (block quotes, list items).

When I've brought this up, though, in commonmark and pandoc forums, people have consistently preferred fenced syntax. I'm still not convinced, though. This could be brought up separately on the discussion list.

rauschma commented 3 months ago

Interesting!

Visually, it helps that closing delimiters have to match the colon counts of opening delimiters:

::::::

Outer

:::
Inner
:::
::::::

If others are interested – this is the discussion: “Side-marked instead of fenced divs?”