jgm / djot.js

JavaScript implementation of djot
MIT License
141 stars 15 forks source link

Clarification around list items #66

Closed eanyanwu closed 10 months ago

eanyanwu commented 10 months ago

First off, I'd like to appreciate the effort and patience you've put into both common mark and djot 🙏🏽 🙏🏽

In trying to understand the syntax better, I ran across what appears to be an inconsistency in nesting block elements inside list items.

playground link

Is this intentional? If so, can you provide some reasoninng behind it (or a link if this has been brought up before)? I'm just trying to get a feel for the rules

Thanks again!

matklad commented 10 months ago

I think you might have pasted a wrong link :)

eanyanwu commented 10 months ago

woops, fixed 🤦🏽‍♂️

jgm commented 10 months ago

You need a blank line between paragraphs and other block-level elements (block quotes, fenced divs, fenced code).

jgm commented 10 months ago

Sorry, I see now that you are asking why you don't need the blank line before fenced code. Well, you do need it before a fenced code block. What you see in the playground is inline code (which can be between matched pairs of backticks of any length, including 3).

Playground

eanyanwu commented 10 months ago

I see, so the difference is that a code block has both an inline and block "form", but the div and blockquote element do not.

Thanks!

jgm commented 10 months ago

Just a terminological note: "code block" refers to the block element; we don't use that terminology for inline code.