API Reference StylesheetParser v#0.1.0

Copy Markdown View Source

Modules

A CSS Syntax Level 3 tokenizer and parser, with CSS Nesting and a Selectors Level 4 selector parser.

An at-rule, such as @import url(theme.css); or @media print { ... }.

Compound selectors joined by combinators, such as .card > h2 span.

Selectors of one element together, such as a.external:hover::after.

A declaration, name: value, in a rule's block or a style attribute.

A function among component values, such as var(--gap, 1rem).

Malformed input, and where it is.

A functional pseudo-class whose arguments parse: :is(), :where(), :not(), and the :nth-*() ones.

A style rule, such as .card > h2 { margin: 0 }.

Selectors Level 4, over component values, as StylesheetParser.parse_component_values/1 returns them: an attribute selector is a [] StylesheetParser.SimpleBlock, and a functional pseudo-class or pseudo-element is a StylesheetParser.Function, its arguments its component values, except for the pseudo-classes whose arguments parse here, a StylesheetParser.PseudoClass: :is(), :where(), :not() and the :nth-*() ones. & is the nesting selector of CSS Nesting.

A block among component values: in (), such as a media feature (width > 600px); in [], such as an attribute selector's; or in {}.

A selector of one part, such as .card or :hover.

The parsing algorithms of CSS Syntax Level 3, as its current draft has them with CSS Nesting, over the tokenizer's tokens, {type, value, metadata} with [line: l, column: c], like Elixir AST.

The tokenizer of CSS Syntax Level 3, over preprocessed input (StylesheetParser.tokenize/1 turns \r\n, \r and \f into \n and NUL into U+FFFD).