Documentation
¶
Overview ¶
Package css is the small CSS tree Marpit's theme pipeline needs: rules, at-rules, declarations and comments, parsed leniently, rewritten, and written back out. It plays the part postcss plays in Marpit; it is not a validating parser, and keeps what it does not understand as written.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasNesting ¶
HasNesting reports whether any rule holds a rule.
func SplitSelectors ¶
SplitSelectors splits a selector list at its top-level commas.
Types ¶
type AtRule ¶
AtRule is an at-rule; Nodes is nil for a statement (@import ...;) and non-nil, possibly empty, for a block.
type Comment ¶
type Comment struct{ Text string }
Comment is a /* comment */; Text excludes the delimiters.
type Node ¶
type Node interface {
// contains filtered or unexported methods
}
Node is a Comment, a Decl, a Rule or an AtRule.
func Flatten ¶
Flatten resolves CSS nesting: a rule nested in a rule becomes a sibling whose selector combines both, and a conditional at-rule nested in a rule wraps a copy of the parent rule.
Marpit runs postcss-nesting, then turns the :is() it produces back into plain selectors when they start from section or :root, so that its later prefixing sees a section. Expanding every parent/child combination gives those plain selectors directly.