Expand description
Parser and syntax tree for Typst.
Modules§
Structs§
- Diag
Span - The span of a diagnostic message. Either from a Typst source file or from a loaded external file.
- Diagnosis
- Whether a node has diagnostic errors and/or warnings in it or its children.
- FileId
- An interned version of
RootedPath. - Lines
- A text buffer and metadata about lines.
- Linked
Children - An iterator over the children of a linked node.
- Linked
Node - A syntax node in a context.
- Range
Mapper - Remaps ranges.
- Rooted
Path - A path in a specific virtual file system root.
- Source
- A Typst source file containing the full source text, a mapping from byte indices to lines/columns, and the parsed syntax tree.
- Span
- Defines a range of text in a Typst source file.
- Span
Number - The unique number of a span within its
Source. Known to be within the range ofSpan::FULL. - Spanned
- A value with a span locating it in the source code.
- SubRange
- A non-empty range targeting a smaller part of a spanned section of text.
- Syntax
Diagnostic - A syntactical error or warning. This is mainly used by converting it to a
SourceDiagnosticduring evaluation. - Syntax
Node - A node in the untyped syntax tree.
- Virtual
Path - A path in a virtual file system.
Enums§
- Diag
Span Kind - The possible kinds of a diagnostic span.
- Path
Error - An error that can occur on construction or modification of a
VirtualPath. - Realize
Error - An error that can occur in
VirtualPath::realize. - Side
- Indicates whether the cursor is before the related byte index, or after.
- Span
Kind - The possible kinds of span.
- Syntax
Kind - A syntactical building block of a Typst file.
- Syntax
Mode - The syntax mode of a portion of Typst code.
- Tag
- A syntax highlighting tag.
- Virtual
Root - The root of a virtual file system.
- Virtualize
Error - An error that can occur in
VirtualPath::virtualize.
Functions§
- highlight
- Determine the highlight tag of a linked syntax node.
- highlight_
html - Highlight a node to an HTML
codeelement. - is_
id_ continue - Whether a character can continue an identifier.
- is_
id_ start - Whether a character can start an identifier.
- is_
ident - Whether a string is a valid Typst identifier.
- is_
newline - Whether a character is interpreted as a newline by Typst.
- is_
valid_ label_ literal_ id - Returns true if this string is valid in a label literal.
- link_
prefix - Extracts a prefix of the text that is a link and also returns whether the parentheses and brackets in the link were balanced.
- parse
- Parses a source file as top-level markup.
- parse_
code - Parses top-level code.
- parse_
math - Parses top-level math.
- split_
newlines - Split text at newlines. These newline characters are not kept.