Skip to content

input.renderChildren ​

How to read this API

These are TypeScript APIs compiled into SnapTeX; a .tex project cannot load them at runtime.

  • function name(...) is a helper that your rule imports and calls.
  • apply(...), render(...), extract(...), and collect(...) are callbacks that your rule implements and SnapTeX calls.
  • renderer.name(...), context.name(...), input.name(...), and deps.name(...) are methods SnapTeX supplies to callbacks; do not import or construct them.
  • service.name(...) is an instance method called after your host or test constructs PreviewUpdateService.

Register extension declarations through SNAP_TEX_RULES in src/rules.ts. See Source API Scope for imports, value ownership, output safety, rebuilds, and testing.

Renders an existing list of parsed AST nodes with the current rules and context. This is the default choice for an environment or group body that already exists in the AST.

Signature ​

ts
input.renderChildren(nodes: readonly SnaptexAstNode[]): string

Returns ​

HTML produced by walking the supplied nodes. The nodes are reused; no parser runs again.

Call relationships ​

  • Provided by: the AST walker on each AstRenderInput.
  • Recursively calls: the current AST rule list.
  • Shares: current metadata, citations, macros, and image renderer.
text
existing child nodes -> current AST walker/rules -> HTML
ts
const body = Array.isArray(input.node.content)
    ? input.renderChildren(input.node.content)
    : '';
return { html: `<aside>${body}</aside>` };

Use this for ordinary child content. Use renderSource only when you have generated or reconstructed LaTeX source rather than existing nodes.

See also ​

A fast structural preview, not a replacement for a full TeX compiler.