Skip to content

Latest commit

 

History

History
95 lines (59 loc) · 5.92 KB

Raw HTML.md

File metadata and controls

95 lines (59 loc) · 5.92 KB

{{($page.frontmatter.start = 632) ? null : null}}

Raw HTML

Text between < and > that looks like an HTML tag is parsed as a raw HTML tag and will be rendered in HTML without escaping. Tag and attribute names are not limited to current HTML tags, so custom tags (and even, say, DocBook tags) may be used.
Here is the grammar for tags:
tag name consists of an ASCII letter followed by zero or more ASCII letters, digits, or hyphens (-).

An attribute consists of whitespace, an attribute name, and an optional attribute value specification.

An attribute name consists of an ASCII letter, _, or :, followed by zero or more ASCII letters, digits, _.:, or -. (Note: This is the XML specification restricted to ASCII. HTML5 is laxer.)

An attribute value specification consists of optional whitespace, a = character, optional whitespace, and an attribute value.

An attribute value consists of an unquoted attribute value, a single-quoted attribute value, or a double-quoted attribute value.

An unquoted attribute value is a nonempty string of characters not including whitespace"'=<>, or `.

single-quoted attribute value consists of ', zero or more characters not including ', and a final '.

double-quoted attribute value consists of ", zero or more characters not including ", and a final ".

An open tag consists of a < character, a tag name, zero or more attributes, optional whitespace, an optional / character, and a > character.

closing tag consists of the string </, a tag name, optional whitespace, and the character >.

An HTML comment consists of <!-- + text + -->, where text does not start with > or ->, does not end with -, and does not contain --. (See the HTML5 spec.)

processing instruction consists of the string <?, a string of characters not including the string ?>, and the string ?>.

declaration consists of the string <!, a name consisting of one or more uppercase ASCII letters,whitespace, a string of characters not including the character >, and the character >.

CDATA section consists of the string <![CDATA[, a string of characters not including the string ]]>, and the string ]]>.

An HTML tag consists of an open tag, a closing tag, an HTML comment, a processing instruction, a declaration, or a CDATA section.

Here are some simple open tags:

Empty elements:

Whitespace is allowed:

With attributes:

Custom tag names can be used:

Illegal tag names, not parsed as HTML:

Illegal attribute names:

Illegal attribute values:

Illegal whitespace:

Missing whitespace:

Closing tags:

Illegal attributes in closing tag:

Comments:

Not comments:

Processing instructions:

Declarations:

CDATA sections:

Entity and numeric character references are preserved in HTML attributes:

Backslash escapes do not work in HTML attributes: