pub struct EnvDefSpec {
pub node_type: NodeType,
pub names: Vec<String>,
pub props: EnvProps,
pub handler: EnvHandler,
pub html_builder: Option<HtmlBuilder>,
pub mathml_builder: Option<MathMLBuilder>,
}
Expand description
Specification for defining LaTeX environments in KaTeX’s parsing system.
This struct encapsulates all the information needed to define how a LaTeX environment should be parsed, processed, and rendered. It serves as the blueprint for environment definitions, mapping LaTeX syntax to KaTeX’s internal representation and output formats.
Environment definitions typically correspond to LaTeX’s
\begin{env}...\end{env}
syntax and are used for structured content like
matrices, alignments, and other mathematical constructs.
§See Also
EnvProps
: Properties controlling parsing behaviorEnvHandler
: Function type for processing environmentsHtmlBuilder
: Function type for HTML generationMathMLBuilder
: Function type for MathML generationcrate::define_function
: Related function definition system
Fields§
§node_type: NodeType
Unique node type identifier for this environment.
Specifies the type of parse node that this environment produces. This is used internally by the parser to categorize and process the environment appropriately.
§Examples
NodeType::Environment
: Generic environment nodeNodeType::Matrix
: Specific matrix environment type
names: Vec<String>
List of LaTeX environment names that use this specification.
Each name corresponds to a LaTeX environment like
\begin{matrix}...\end{matrix}
. Multiple names can share the same
specification for environments with similar parsing rules (e.g.,
“matrix” and “pmatrix”).
props: EnvProps
Properties that control parsing behavior for this environment.
Defines argument requirements, mode restrictions, and other parsing constraints that apply to this environment type.
handler: EnvHandler
Core function that processes the environment’s arguments and produces a parse node.
This handler is responsible for validating arguments, processing the environment content, and creating the appropriate internal representation. It receives the parsing context and arguments, then returns a parse node that can be rendered to HTML/MathML.
html_builder: Option<HtmlBuilder>
Optional function for generating HTML output from the parse node.
If provided, this function will be called during HTML rendering to
produce the final HTML representation of the environment. If None
,
a default HTML builder may be used or rendering may fail.
§See Also
HtmlBuilder
: The function signature for HTML builders
mathml_builder: Option<MathMLBuilder>
Optional function for generating MathML output from the parse node.
If provided, this function will be called during MathML rendering to
produce the final MathML representation of the environment. If None
,
a default MathML builder may be used or rendering may fail.
§See Also
MathMLBuilder
: The function signature for MathML builders
Trait Implementations§
Source§impl Clone for EnvDefSpec
impl Clone for EnvDefSpec
Source§fn clone(&self) -> EnvDefSpec
fn clone(&self) -> EnvDefSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more