Repository navigation
Glossary
The HTML Standard has a vocabulary of its own, and Parsec adds a few words to it. When a page in this wiki uses one of them, its first use links here. Each entry says what the word means in a sentence or two, then points you at the page that goes deeper.
A · C · D · F · I · N · P · Q · R · S · T · V
The tree builder's list of formatting elements (<a>, <b>, <i>, <font> and the like) that are still in effect. When something closes a formatting element early, the builder reopens it where text continues, so in <p><b>bold</p><p>still bold the second paragraph gets a <b> of its own. Markers in the list stop that reopening at the edge of a table cell, a template and a few others. Parsec keeps the list as active in tree.rs; see Architecture.
The HTML Standard's algorithm for repairing misnested formatting. It's what turns <b>1<p>2</b>3</p> into <b>1</b><p><b>2</b>3</p>: the <b> is split so each piece nests properly. Architecture walks through its steps, and Limits and hostile input explains why its bounds matter.
How Parsec stores a document: every node in one vector, linked to its parent, children and siblings by index rather than by pointer. You hold a NodeId, which is an index into that vector. A document is built, and freed, with a handful of allocations rather than one per node. See Architecture.
The character U+FEFF at the very start of a file, which some editors write to mark it as UTF-8. A browser drops it while decoding. Parsec takes text that's already decoded, so it sees the mark as a character, and you should strip it first; Parsing shows how.
<![CDATA[...]]>, whose contents are text with no markup in them. The HTML parser only honours it inside SVG and MathML; in ordinary HTML it becomes a bogus comment. See Tokenizer.
The element a fragment is parsed inside, as if you were setting its innerHTML. The context decides how the tokenizer starts and which insertion mode the tree builder starts in: <td>a<td>b keeps its cells in a tr context and loses them in a div one. Also called the fragment context. See Parsing.
The CI job that keeps Parsec's parser in step with Netweir's. It checks out Netweir at the commit in NETWEIR_COMMIT, runs the sync script with --check, and fails if crates/parsec doesn't match. See Contributing.
SVG and MathML inside an HTML page. The tree builder parses them by separate rules: element and attribute names get their proper case back (clipPath, viewBox), self-closing tags close, and certain HTML tags break back out into HTML. See Architecture.
A selector list that drops entries it can't parse instead of failing. :is() and :where() take one, so :is(h1, ::nonsense) means :is(h1). :not() and :has() don't: one bad entry makes the whole selector an error. See Selectors.
What the tree builder does with content that turns up inside a table where it isn't allowed, such as text between <table> and <td>. Rather than put it in the table, it moves it to just before the table. See Architecture.
The tree builder's state. There are 21 of them in Parsec (in_body, in_table, after_head and so on), and the current one decides what each token means: a <td> does one thing in a table and is ignored in a <div>. See Architecture.
The places inside SVG and MathML where HTML parsing takes over again. SVG's foreignObject, desc and title are HTML integration points; MathML's mi, mo, mn, ms and mtext are text integration points; annotation-xml is one when its encoding says HTML. See Architecture.
The &name; forms such as &, < and . The HTML Standard lists 2,231 of them, and Parsec decodes every one. See The document tree.
Parsec's handle for a node: a u32 index into the document's arena. You read and change nodes by passing their ids to the document. A removed node's id stays valid, because nothing is freed until the document goes. See The document tree.
A rule in the HTML Standard that keeps at most three identical formatting elements in the active formatting elements list after the last marker. It's one of the bounds that stop thousands of repeated <b> tags from making every paragraph expensive. See Limits and hostile input.
The first step of parsing: every \r\n and every lone \r becomes \n. Parsec does it before tokenizing, so text you read back only ever has \n. See Tokenizer.
How a browser treats a page with no doctype, or an old one: some layout rules change, and so do a few parsing and selector rules. A document is in one of three modes, Quirks::Quirks, Quirks::Limited or Quirks::No. In full quirks mode, ids and class names match without case, and a <table> doesn't close an open <p>. See Parsing.
Elements whose contents the tokenizer reads as text, not markup: <script>, <style>, <xmp>, <iframe>, <noembed>, <noframes>, <plaintext>, and <noscript> when scripting is on. The serializer writes their text back without escaping. See Serialization.
Whether the parse imitates a browser with JavaScript on or off. Parsec never runs scripts; the flag only changes how <noscript> is parsed. See Parsing.
The trait the tokenizer hands its tokens to. The tree builder is a sink; write your own to read tokens without building a tree. See Tokenizer.
How a node holds a string: a start and end offset, plus two flag bits saying which buffer they point into. Most spans point straight into the document's copy of the input, so most text is never copied. See Architecture.
The tree builder's list of elements that have started and not yet ended, innermost last. Most of the HTML Standard's questions ("is there a <p> in button scope?") are questions about this stack. See Limits and hostile input.
The children of a <template>, which the HTML Standard keeps out of the main tree in a fragment of their own. Selectors, children and text don't look inside. See The document tree.
The tokenizer states for elements whose contents aren't ordinary markup. RCDATA (<title>, <textarea>) treats tags as text but still decodes references; RAWTEXT (<style> and others) decodes nothing; script data is for <script>; PLAINTEXT never ends. See Tokenizer.
Elements that never have contents or an end tag, such as <br>, <img> and <input>. The serializer writes no end tag for them. See Serialization.
- Architecture, where most of these terms are put to work.
- FAQ, for the questions these words tend to come up in.
Parsec is Apache-2.0 and not yet released; these pages describe main. Found something wrong here? Open an issue or ask in Discussions.
Repository · Issues · Discussions · Roadmap · Security policy · Licence