Tags in Raw HTML

Apologies if this has already been discussed, I did a quick search but I could have missed it.

Is the following interpretation of the spec correct:

  1. Raw HTML can contain any tag names I’d like
  2. Raw HTML can only occur inside an HTML block
  3. HTML blocks only start with one of a small number of elements (address, article, …)?

In other words, while 6.8 says I can use any element names I’d like, 4.6 says I can only do so within the context of one of an enumerated list of existing HTML tags.

You are not limited to existing HTML tags.

Note that the list of tags in section 4.6 occurs in a description of one of seven different ways to create a raw HTML block.

The essential point is this: if you have a chunk of text that starts with a tag, but the tag doesn’t appear on a line by itself, then the tag will be interpreted as inline HTML unless it’s on that list, otherwise as block HTML.

So, for example, you can include DocBook tags. But if you want a chunk of text to be interpreted as a block-level element (and not as part of a paragraph), you should put the opening and closing tags on lines by themselves.

Also, if you want the contents of the block to be interpreted as Markdown, not passed through as raw “HTML,” put a blank line after the opening tag and before the closing tag. Section 4.6 has a number of examples that should illustrate these concepts.

(And, raw HTML can occur inside a regular paragraph; that is what section 6.8 is about.)

1 Like