Public API for the Scripta compiler.
Default options: no filter, 800px window and content width, light theme, no table of contents, default sizing, unlimited heading level.
Set the window width in pixels.
Set the content (text column) width in pixels.
Show or hide the table of contents.
Set the maximum heading level to render.
Set the sizing configuration.
Set the forest filter.
Light or dark theme.
Forest filter. NoFilter renders everything; SuppressDocumentBlocks
hides document and title blocks.
Sizing/spacing configuration (a record).
Default sizing configuration.
An opaque parsed document. Produced by parse / reparse, consumed by
render and the Scripta.Document query functions.
A single source edit: a character range removed replaced by inserted,
starting at character offset in the pre-edit document.
An interaction event emitted by rendered output.
ClickedId — the user clicked an element with the given id.ClickedFootnote / ClickedCitation — jump to a target, remembering a return id.ClickedImage — the user clicked an image (url).ClickedLink — the user clicked an internal document link (slug).HighlightedId — request to highlight the element with the given id.Rendered output, polymorphic in the message type so mapEvent can retarget it.
Parse source text into a Document (cold path: full parse).
For editor keystroke updates use reparse, which is incremental.
Re-parse source text incrementally, reusing the previous Document's cache
and accumulator where it is safe to do so. Use this for editor keystroke
updates; use parse for initial load and document switches.
Render a parsed Document to HTML output carrying Events.
Retarget a whole Output from Event to the consumer's own message type.
Apply one edit's fast metadata shift to a Document, keeping the RL-sync map (data-begin/data-end/data-lines/id) valid without reparsing content.
This is the high-frequency path (run per keystroke). It does NOT refresh
block content or rendering — use reparse on a longer debounce for that.
Apply a queue of edits in order (each in the coordinate space of the document produced by the previous edit).
Export a parsed Document as a complete standalone HTML document (a single String).
The output is meant for static viewing or printing: it includes a <head>
that pulls KaTeX from a CDN for math rendering and a default stylesheet,
plus a <body> containing the title, optional TOC, and rendered content.
None of the interactive editor-sync handlers are included.
Export a parsed document as a complete LaTeX document, with preamble, ready
for xelatex. The title and authors go into the document's title block.
Export a parsed document as LaTeX: the body only, without the preamble.
Pretty-print Scripta source text: parse it and write it back out with standard indentation and spacing.
Opaque compiler options. Build with
defaultOptionsand thewith*functions.