commonmark-spec icon indicating copy to clipboard operation
commonmark-spec copied to clipboard

Void elements spec

Open glebm opened this issue 7 years ago • 7 comments

Void elements as described in the HTML spec should not start a CommonMark HTML block, because void elements cannot have any content.

The void elements are:

area base br col embed hr img input link menuitem meta param source track wbr

This updates the spec to account for void elements. Refs #435

glebm avatar Nov 06 '16 21:11 glebm

@jgm if this looks good to you, I'd be happy to put the changes together to cmark for this.

kivikakk avatar Nov 07 '16 08:11 kivikakk

There’s some more, mostly legacy elements: basefont, bgsound, command, frame, image, isindex, keygen, nextid listen in HTML, HTML4, and HTML5 (source), which may be useful to add?

wooorm avatar Nov 07 '16 08:11 wooorm

Thanks! Let's wait a little longer for comment (I've also linked this from talk.commonmark.org).

+++ Yuki Izumi [Nov 07 16 00:13 ]:

[1]@jgm if this looks good to you, I'd be happy to put the changes together to cmark for this.

jgm avatar Nov 07 '16 09:11 jgm

@wooorm Good catch, I will add the legacy elements to the list. Update: Added in https://github.com/jgm/CommonMark/pull/436/commits/3f292b5108be8ac75aa0ed8b322406b42243495a https://github.com/jgm/CommonMark/pull/436/commits/ac762f746f8bf15ff3ff55b0c6edc60079a970ad.

glebm avatar Nov 08 '16 10:11 glebm

I think another class of tags that should not start an HTML block is self-closing tags. ~~I'll add them as well.~~ What do you think? If you agree, then I can add a separate proposal.

glebm avatar Nov 08 '16 11:11 glebm

I've started a discussion about self-closing tags and tags closed at the end of the same line that has the starts them here: https://talk.commonmark.org/t/reason-for-starting-an-html-block-when-the-closing-tag-is-on-the-same-line/2290/1

glebm avatar Nov 11 '16 13:11 glebm

Void elements as described in the HTML spec should not start a CommonMark HTML block, because void elements cannot have any content.

But the HTML block is not just about having content, but also about not being wrapped by <p>...</p> which will happen if you downgrade those tags to an inline HTML.

Also the HTML blocks with all those start and end conditions are quite simplified and, as such, majority of the block contents does not really have to be valid HTML at all, so trying to interpret something of it more specially IMHO does not make much sense, unless you aim to specify the blocks into more details in other aspects too; e.g. by specifying how the whole block has to look like instead of just those start/end conditions.

mity avatar Aug 09 '17 16:08 mity