Crate typst_syntax

Source
Expand description

Parser and syntax tree for Typst.

Modules§

ast
A typed layer over the untyped syntax tree.
package
Package manifest parsing.

Structs§

FileId
Identifies a file in a project or package.
LinkedChildren
An iterator over the children of a linked node.
LinkedNode
A syntax node in a context.
Source
A source file.
Span
A unique identifier for a syntax node.
Spanned
A value with a span locating it in the source code.
SyntaxError
A syntactical error.
SyntaxNode
A node in the untyped syntax tree.
VirtualPath
An absolute path in the virtual file system of a project or package.

Enums§

Side
Indicates whether the cursor is before the related byte index, or after.
SyntaxKind
A syntactical building block of a Typst file.
Tag
A syntax highlighting tag.

Functions§

highlight
Determine the highlight tag of a linked syntax node.
highlight_html
Highlight a node to an HTML code element.
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.
parse_code
Parses top-level code.
parse_math
Parses top-level math.
split_newlines
Split text at newlines. These newline characters are not kept.