commonmark / commonmark-spec

CommonMark spec, with reference implementations in C and JavaScript
http://commonmark.org
Other
4.89k stars 317 forks source link

Add clarifying tests about HTML and block quotes #738

Closed notriddle closed 2 months ago

notriddle commented 1 year ago

This result makes sense, since inline HTML being inline implies that it is parsed after block quotes, while block HTML being copy-and-pasteable implies that it should eat Markdown syntax like block quotes. However, pulldown-cmark got this wrong, and apparently so do MD4C, markdown-it, and parsedown, according to Babelmark 3.

wooorm commented 1 year ago

Hmm, this doesn’t have anything to do with block quotes, from what I understand?

What’s going on in these two cases is that the start condition of HTML kind 6 matches for <div. But no block HTML start condition matches for <di or <d or <a or whatever else (but with a >, so <a>, it would match HTML kind 7).

https://spec.commonmark.org/0.30/#html-blocks.

Some examples:

<div
> a

<di>
> b

<di
> c

The same happens for “containers” other than block quotes:

<div
* d

Or say headings:

<div
# e?
notriddle commented 1 year ago

It's true that the <a tag isn't the start of an HTML block, but it is valid inline HTML. Try this example:

<a
ping>
wooorm commented 1 year ago

Right, but that’s something else. The inline rules/algos have nothing to do with how (block quotes and) HTML interact.

notriddle commented 1 year ago

Which section of the spec do you think these test cases belong in, then?

wooorm commented 1 year ago

From a quick glance, this seems close to the cases of https://spec.commonmark.org/0.30/#example-156 and 157? It has “emphasis” currently, and could also have say an ATX heading and a block quote?

notriddle commented 1 year ago

@wooorm Okay, I sorted the examples under the HTML Block and Raw HTML sections.

notriddle commented 2 months ago

Are there any additional blocking concerns for this patch?

jgm commented 2 months ago

Looks good to me!