core¶
Generated by tools/casefold from tools/data/CaseFolding-17.0.0.txt ; do not edit.
Types
- core.Admonition_Kind :: enum i32¶
-
- Generic¶
- Attention¶
- Caution¶
- Danger¶
- Error¶
- Hint¶
- Important¶
- Note¶
- Tip¶
- Warning¶
- Seealso¶
- Todo¶
- core.Anchor_Extra :: struct¶
-
Anchor_Extra is the id of an element a renderer generates for a node:
- an entry of a table of contents: owner is the Contents, item the Section;
- a footnote of target-notes: owner is the directive, item the first target (or anonymous reference) with the URI it lists, number its footnote number;
- the footnote reference target-notes adds after a reference: owner is the reference, item the directive, note the item of its footnote, number the same.
- span: u32¶
- number: i32¶
- core.Anchors :: struct¶
-
Anchors gives nodes stable, unique identifiers: HTML ids and Typst labels. Every renderer and the project host build the same table, so internal links agree across targets and the labels a project records are the ids its pages publish. The ids are the ones Docutils gives a document read as Sphinx reads it (auto_id_prefix „id“), so a project that moves from Sphinx keeps its links and bookmarks:
- An explicit Id attribute is used verbatim (terms, equations, domain objects).
- Every element Docutils names gets one id when Docutils‘ parser or transforms name it, in the same order (anchors_order.odin): the id made from its name by make_id, or, when the name gives none or only an id already used, the next „idN“. Elements without a name (footnote references, anonymous targets) always take the next „idN“.
- Targets and names Docutils does not write (external and indirect targets, names of embedded URIs) still take their id, so later ids are numbered as Docutils numbers them, but no node carries it.
- A label (an internal block Target) gives its id to the element it names, after the element’s own ids.
- Elements a renderer generates have ids too (anchor_extras): the entries of a table of contents and the footnotes of target-notes with their references.
A node may have several ids: anchor_of returns the primary one, and anchor_ids iterates all of them for renderers that emit the others as aliases.
- index: []u32¶
-
per node: its first span, or NONE.
- next: []u32¶
-
per span: the node’s next span, or NONE.
- count: int¶
- prefix: string¶
- prefix_length: int¶
-
the bytes the prefix takes before an id.
- names: Symbol_Table¶
-
every id: the node that carries it, or NONE.
- counter: int¶
- labels: []u32¶
-
per node: the first id labels give it, until they follow its own.
- own: []u8¶
-
room for the longest name a node carries by itself.
- extras: []Anchor_Extra¶
-
sorted by owner, then in the order the ids were given.
- extra_count: int¶
- core.Attribute :: struct¶
-
- key: Attribute_Key¶
- core.Attribute_Key :: enum u8¶
-
- Custom¶
- Class¶
- Id¶
- Name¶
- Language¶
- Alt¶
- Width¶
- Height¶
- Scale¶
- Align¶
- Format¶
- Title¶
- Target¶
- Start¶
- Widths¶
- Source¶
- core.Buffer :: struct¶
-
Buffer is a bounded byte accumulator over caller-provided bytes. The first write that does not fit sets overflow, and every later write is dropped, so the bytes are always a prefix of what was written; a caller that sees overflow must report it. wanted counts every byte asked for, stored or not: writing into a zero Buffer measures, and scratch_buffer then takes exactly that much.
- bytes: []u8¶
- used: int¶
- wanted: int¶
- overflow: bool¶
- core.Builder :: struct¶
-
Builder appends nodes in preorder. Open nodes form a bounded stack; closing a node patches its subtree end. The first failure poisons the builder: later calls do nothing, so an ignored capacity failure cannot produce a truncated document. The engine gives a reader or pass a builder over one bank for one stage: text is copied into the bank’s pool, ids and Text values index that bank, and nothing a builder returns outlives the stage unless the stage succeeds. Adapters change nodes through these procedures; b.snap is visible so a reader can decode text straight into the pool after text_used, adding what it wrote to text_used before text_close.
- need: Capacity_Need¶
- work: u64¶
- cancel: Cancel_Probe¶
- core.Content :: enum u8¶
-
- Nothing¶
- Blocks¶
- Inlines¶
- Structure¶
-
children are restricted to specific kinds; see child_allowed.
- core.Content_Policy :: enum u8¶
-
- Refuse¶
-
an error that names the construct and the policy.
- Omit¶
-
a warning; the content is left out.
- Allow¶
-
trusted content is emitted.
- core.Diagnostic :: struct¶
-
- using msg: Message¶
- span: Source_Span¶
- args: [2]Diagnostic_Arg¶
- core.Diagnostic_Arg :: struct¶
-
Diagnostic_Arg is an integer, a quoted source span, or static text.
- int: i64¶
- span: Source_Span¶
- static: string¶
- core.Document :: struct¶
-
Document is a checked handle to one build of a snapshot bank of a workspace. It borrows the workspace and is valid until the next conversion, reset, or rebuild of its bank, whichever comes first; document_valid tells.
- generation: u32¶
- revision: u32¶
-
the bank’s revision when the document was built.
- bank: u8¶
- core.Document_Reading :: enum i32¶
-
Document_Reading is a Document’s
value: who read it, which decides the ids the transforms after reading give (anchors_order.odin). The Sphinx layer marks what it reads, as Sphinx adds transforms of its own to Docutils‘.- Docutils¶
- Sphinx¶
- core.Emit_Mode :: enum u8¶
-
A renderer has one encoding procedure. The engine runs it in Measure mode, with reports enabled, to check support and count bytes; then in Write mode to store them.
- Measure¶
- Write¶
- core.Emitter :: struct¶
-
Emitter is where a renderer writes. It never fails: Measure mode counts bytes, and Write mode stores them in the caller’s output, which the engine sized by measuring.
- out: []u8¶
- written: int¶
- mapped: int¶
- core.Highlighter :: struct¶
-
Highlighter writes highlighted HTML for a code block. It belongs to the caller’s trust boundary and may allocate, but it must write the same bytes for the same input every time, because the renderer measures before it writes. It returns false to let the renderer write plain escaped code instead.
- user: rawptr¶
- core.Label :: enum u8¶
-
Label names a word or phrase a renderer writes by itself, not taken from the document, or that a reader writes into it (the group names of Sphinx’s info fields). A host translates them (Sphinx ships them in sphinx.po) and passes them in Render_Options.labels, and to a reader in its own options. Labels holding „%s“ take a value there (a version number).
- Attention¶
- Caution¶
- Danger¶
- Error¶
- Hint¶
- Important¶
- Note¶
- Tip¶
- Warning¶
- See_Also¶
- Todo¶
- Contents¶
- Version_Added¶
- Version_Changed¶
- Version_Deprecated¶
- Version_Removed¶
- Section_Author¶
- Module_Author¶
- Code_Author¶
- Link_Heading¶
- Link_Definition¶
- Link_Image¶
- Link_Table¶
- Link_Code¶
- Link_Equation¶
- Link_Term¶
- Parameters¶
- Variables¶
- Raises¶
- Returns¶
- Return_Type¶
- Return_Values¶
- Template_Parameters¶
- Throws¶
- Arguments¶
- Availability¶
- core.Labels :: [Label]string¶
- core.Limits :: struct¶
-
- max_depth: int¶
-
nested blocks and inline markup.
- max_nodes: int¶
- max_work: u64¶
-
reader and resolution steps.
- max_include_depth: int¶
- max_included_bytes: int¶
- max_expansion: int¶
-
substitution nesting.
- stack_bytes: int¶
-
stack_bytes bounds the machine stack a recursive reader or renderer uses; 0 means DEFAULT_STACK_BYTES. The conversion thread needs this much more stack (stack.odin).
- core.Line_View :: struct¶
-
Line_View is one line of a source as readers hand it to each other: its text without the line break, and the source offset of text[0]. The reST and Markdown readers share it, so nested content passes between them as it is, without converting or casting.
- text: string¶
- offset: u32¶
- core.Link_Info :: struct¶
- core.Link_Kind :: enum u8¶
-
- External¶
-
destination is a URL or path.
- Email¶
-
destination is an address; HTML adds mailto:.
- Internal¶
-
resolved is a node in this document.
- Unresolved¶
-
name awaits resolution; an error, or a warning and problematic text
- Project¶
-
under Policy.keep_documents_with_errors.
destination is a project anchor key in another document (books).
- core.List_Info :: struct¶
-
- style: List_Style¶
- delimiter: u8¶
-
‚.‘, ‚)‘, or ‚(‚ for „(1)“; bullet character for bullets.
- start: i32¶
- core.Map_Entry :: struct¶
-
Map_Entry records that generated output from offset on came from span.
- offset: u32¶
- span: Source_Span¶
- core.Math_Style :: enum u8¶
-
Math_Style is how HTML writes math for a script (MathJax, KaTeX) to typeset.
- Plain¶
-
class „math“, the text in \( \) or \[ \], as Docutils writes it.
- Sphinx¶
-
as Sphinx’s mathjax extension: its classes, and displayed math in parts
- core.Media_Kind :: enum u8¶
-
Media_Kind is what an image node shows. As in Docutils, an image directive naming a video file plays it; Guidedoc treats audio files the same way. Renderers decide from the path.
- Image¶
- Video¶
- Audio¶
- core.Message :: struct¶
-
Message is a static description of one problem. Packages declare them as constants, so a report never formats or copies text.
- code: string¶
- title: string¶
- message: string¶
-
„{0}“ and „{1}“ name the arguments.
- hint: string¶
- core.Node :: struct¶
-
- flags: Node_Flags¶
- subtree_end: u32¶
- value: i32¶
- payload: u32¶
- span: Source_Span¶
- attributes: Attribute_Range¶
- core.Node_Flag :: enum u8¶
-
- Tight¶
-
List: items render without paragraph spacing.
- Anonymous¶
-
Reference or Target: anonymous hyperlink.
- Auto¶
-
Footnote or reference: auto-numbered.
- Symbol¶
-
Footnote or reference: auto-symbol.
- Local¶
-
Contents: only the enclosing section.
- Header¶
-
Row or Cell: belongs to a header.
- Referenced¶
-
Target or Footnote: something refers to it.
- Generated¶
-
Created by resolution rather than markup.
- core.Node_Id :: distinct u32¶
- core.Node_Kind :: enum u8¶
-
- Document¶
- Title¶
-
Block structure.
- Subtitle¶
- Section¶
- Heading¶
- Paragraph¶
- Block_Quote¶
- Attribution¶
- List¶
- List_Item¶
- Definition_List¶
- Definition_Item¶
- Term¶
- Classifier¶
- Definition¶
- Field_List¶
- Field¶
- Field_Name¶
- Field_Body¶
- Option_List¶
- Option_Item¶
- Option_Group¶
- Option¶
- Option_Argument¶
- Option_Description¶
- Line_Block¶
- Line¶
- Code_Block¶
- Preformatted¶
- Doctest_Block¶
- Math_Block¶
- Raw_Block¶
- Thematic_Break¶
- Table¶
- Table_Head¶
- Table_Body¶
- Row¶
- Cell¶
- Figure¶
- Caption¶
- Legend¶
- Admonition¶
- Topic¶
- Sidebar¶
- Rubric¶
- Container¶
- Compound¶
- Footnote¶
- Citation¶
- Target¶
- Comment¶
- Substitution_Definition¶
- Contents¶
- Directive¶
- Toctree¶
-
Sphinx layer (GDS „Guidedog: everything Sphinx does, the Odin way“).
- Toctree_Entry¶
- Only¶
- Glossary¶
- Version_Modified¶
- Desc¶
- Desc_Signature¶
- Desc_Content¶
- Hlist¶
- Production_List¶
- Production¶
- Index¶
- Text¶
-
Inline content.
- Emphasis¶
- Strong¶
- Code¶
- Link¶
- Reference¶
- Image¶
- Footnote_Reference¶
- Citation_Reference¶
- Substitution_Reference¶
- Inline_Target¶
- Math¶
- Raw_Inline¶
- Soft_Break¶
- Hard_Break¶
- Subscript¶
- Superscript¶
- Title_Reference¶
- Abbreviation¶
- Role¶
- Xref¶
-
Sphinx layer inlines.
- Desc_Name¶
- Desc_Addname¶
- Desc_Annotation¶
- Desc_Parameterlist¶
- Desc_Parameter¶
- Desc_Optional¶
- Desc_Returns¶
- core.Pass :: struct¶
-
A pass reads an immutable document and may rebuild it into the destination builder.
- name: string¶
- procedure: proc(user: rawptr, doc: Document, b: ^Builder) -> Pass_Outcome¶
- user: rawptr¶
- core.Policy :: struct¶
-
- raw: Content_Policy¶
-
raw HTML, raw Typst, raw LaTeX.
- unsafe_urls: Content_Policy¶
-
javascript:, vbscript:, and non-image data: URLs.
- math: Content_Policy¶
-
math the target cannot translate.
- includes: bool¶
-
whether include directives may request resources.
- strict: bool¶
-
warnings fail the conversion.
- keep_documents_with_errors: bool¶
-
keep_documents_with_errors keeps a document whose content has errors, as Docutils does below its halt level: an unknown directive or role, an unresolved reference, or a bad option is still reported as an error, but the construct is left out (or rendered as problematic text) and the status is Ok. Renderers report such problems as warnings. Errors that leave no usable tree still fail: capacity, limits, cancellation, invalid storage, and validation. See content_error.
- core.Read_Context :: struct¶
-
- options: Read_Options¶
- resources: Resource_Provider¶
- included: int¶
-
bytes of included sources, charged against max_included_bytes.
- core.Read_Extension :: struct¶
-
Read_Extension carries a reader’s own settings (rst.Settings, sphinx.Config, commonmark.Settings, or a third-party reader’s type): a pointer the caller owns and the type it points to. read_extension makes one, and a reader takes it back with reader_settings, which refuses settings of another type, so settings meant for one reader are never read as another’s. The zero value means the reader’s defaults.
- data: rawptr¶
- id: typeid¶
- core.Read_Inline_Proc :: #type proc(ctx: ^Read_Context, span: Source_Span) -> Status¶
-
Read_Inline_Proc parses a span of ctx.source as inline content of the builder’s open node, with the reader’s settings (ctx.options.extension), as a translated message is parsed. It neither resolves references nor reports unresolved ones: the caller owns the surrounding document. span.source must be ctx.source.
- core.Read_Options :: struct¶
-
- promote_title: bool¶
-
RST: a lone top-level section becomes the title.
- tab_width: int¶
-
RST tab stops; zero means 8.
- today: string¶
-
RST date substitutions, e.g. 2026-09-29.
- extension: Read_Extension¶
-
the reader’s own settings; zero: its defaults.
- core.Read_Proc :: #type proc(ctx: ^Read_Context) -> Status¶
-
Read_Proc reads ctx.source into ctx.b and returns its status; see Reader.
- core.Reader :: struct¶
-
- id: string¶
- name: string¶
- version: string¶
- conformance: Conformance¶
- read_inline: Read_Inline_Proc¶
-
optional; see Read_Inline_Proc.
- core.Region :: enum u8¶
-
- None¶
- Nodes¶
- Text¶
- Attributes¶
- Lists¶
- Links¶
- Cells¶
- Sources¶
- Scratch¶
- Reports¶
- Output¶
- Source_Map¶
- Second_Bank¶
-
the workspace has no bank B, which passes that rebuild write.
- core.Render_Context :: struct¶
-
- options: Render_Options¶
- core.Render_Options :: struct¶
-
- standalone: bool¶
-
a complete document rather than a body fragment.
- reference_profile: bool¶
-
CommonMark reference HTML, for conformance tests.
- title: string¶
-
overrides the document’s own title.
- language: string¶
-
BCP 47 tag; „en“ when empty.
- stylesheet: string¶
-
standalone HTML: CSS emitted in a style element.
- section_numbers: bool¶
- anchor_prefix: string¶
-
prepended to every anchor, e.g. a document ID in a book.
- permalinks: bool¶
-
HTML: a link to each heading, caption, and signature.
- permalink_icon: string¶
-
„¶“ when empty.
- secnumber_suffix: string¶
-
after section numbers; „. „ when empty.
- highlighter: Highlighter¶
- math: Math_Style¶
- math_inline: [2]string¶
-
HTML math delimiters for the script that typesets it, with Math_Style.Sphinx; empty: \( \) inline and \[ \] displayed, as Sphinx’s mathjax_inline and mathjax_display default to.
- math_display: [2]string¶
- core.Render_Proc :: #type proc(ctx: ^Render_Context) -> Status¶
-
Render_Proc writes ctx.view with ctx.out and returns its status; see Renderer.
- core.Renderer :: struct¶
-
- id: string¶
- name: string¶
- version: string¶
- media_type: string¶
- conformance: Conformance¶
- render: Render_Proc¶
- core.Reports :: struct¶
-
- items: []Diagnostic¶
- used: int¶
- suppressed: int¶
- truncated: bool¶
- muted: bool¶
-
write mode repeats the checked encoding without reporting.
- primary: Diagnostic¶
- has_primary: bool¶
- errors: int¶
- warnings: int¶
- core.Request :: struct¶
-
- reader: string¶
- renderer: string¶
- read: Read_Options¶
- render: Render_Options¶
- resources: Resource_Provider¶
- cancel: Cancel_Probe¶
- core.Resource_Provider :: struct¶
-
Resource_Provider belongs to the caller’s trust boundary and may allocate. The core passes the requesting source and the name as written; the provider returns borrowed UTF-8 text valid for the whole conversion, and a canonical name for cycle checks.
- procedure: proc(user: rawptr, from: Source, name: string) -> (text: string, canonical: string, status: Resource_Status)¶
- user: rawptr¶
- core.Resource_Status :: enum u8¶
-
- Ok¶
- Missing¶
- Refused¶
- Limit¶
-
the host’s memory budget cannot hold it.
- core.Result :: struct¶
-
Result is the outcome of a stage. reports borrows the workspace’s reports region, valid until the next conversion or reset; primary is the first error by value, so it survives both. On Capacity, need names the region to enlarge.
- written: int¶
- reports: []Diagnostic¶
- primary: Diagnostic¶
- need: Capacity_Need¶
- mapped: int¶
-
source_map entries written.
- suppressed: int¶
- truncated: bool¶
- core.Scratch_Mark :: distinct int¶
-
Scratch is stage-local storage carved from the caller’s byte slice. Taking scratch advances a used-count; it is not an allocator call. A stage records a mark and releases to it when it finishes.
- core.Slab_Plan :: struct¶
-
- nodes: int¶
- attributes: int¶
- lists: int¶
- links: int¶
- cells: int¶
- text: int¶
- scratch: int¶
- sources: int¶
- reports: int¶
- output: int¶
- second_bank: bool¶
- core.Source_Entry :: struct¶
-
- using source: Source¶
- included_at: Source_Span¶
-
the include directive, when included.
- use: Source_Use¶
-
how an included source is read.
- core.Source_Id :: distinct u16¶
- core.Source_Span :: struct¶
-
Source_Span is a half-open byte range in a source of the workspace source table.
- start: u32¶
- end: u32¶
- core.Source_Use :: enum u8¶
-
Source_Use tells how the reader uses an included source: parsed as markup (include), or shown as it is (literalinclude, a graph file). Hosts can tell a document’s parts from files it only quotes, as Sphinx’s env.included does.
- Parsed¶
- Literal¶
- core.Stack :: struct($T: typeid)¶
-
Stack is a bounded LIFO over caller-provided items.
- items: []T¶
- used: int¶
- core.Status :: enum u8¶
-
- Ok¶
- Invalid_Input¶
- Unsupported¶
- Policy¶
- Capacity¶
- Limit¶
- Cancelled¶
- Internal¶
- core.Storage :: struct¶
-
Storage lists every region a workspace borrows. All lengths are capacities.
- banks: [2]Snapshot_Storage¶
- scratch: []u8¶
- sources: []Source_Entry¶
- reports: []Diagnostic¶
- core.Symbol :: struct¶
-
Symbol_Table is open addressing over caller-provided slots. It never grows. The load factor stays at or below one half, and probes are bounded, so hostile keys cost a bounded amount of work and end in a limit report rather than a slow scan.
- hash: u64¶
- key: string¶
-
borrowed; must outlive the table.
- value: u32¶
- used: bool¶
- core.Table :: struct($T: typeid)¶
-
Table is a caller-owned SoA slice with a used-count. Appending never allocates.
- rows: []T¶
- used: int¶
- core.Text :: struct¶
-
Text is a byte range in the active snapshot’s text pool.
- start: u32¶
- length: u32¶
- core.View :: struct¶
-
View is the read-only form renderers and passes traverse. Obtaining a view checks the handle once; accessors are then plain bounds-checked indexing. Strings they return borrow the snapshot’s text pool or the sources, valid while the document is valid. An id out of range is a programming error (a bounds-check panic), not a data error: ids come from the view itself.
- sources: []Source_Entry¶
- core.Workspace :: struct¶
-
Workspace is one conversion’s borrowed storage. A document handle names a generation (one conversion, from read to render) and a bank’s revision (one build of that bank); both only grow, so a handle to a cleared or rebuilt bank never becomes valid again.
- revisions: [2]u32¶
-
raised whenever a bank is cleared to be built again.
- active: int¶
- generation: u32¶
- sources: []Source_Entry¶
- sources_used: int¶
- keep_errors: bool¶
-
the read’s Policy.keep_documents_with_errors; passes honour it.
- output: []u8¶
-
optional; set by init_workspace_from_bytes for convert_text.
- ready: bool¶
Procedures
- core.add_attribute :: proc(b: ^Builder, id: Node_Id, key: Attribute_Key, value: Text, name := Text{})¶
-
add_attribute requires that id is the most recently begun node, so each node’s attributes stay contiguous.
- core.add_attribute_string :: proc(b: ^Builder, id: Node_Id, key: Attribute_Key, value: string, name := "")¶
-
add_attribute_string copies value (and name, for a Custom key) into the text pool and adds the attribute as add_attribute does.
- core.add_flags :: proc(b: ^Builder, id: Node_Id, f: Node_Flags)¶
-
add_flags adds flags to node id; nothing happens once the builder has failed.
- core.add_leaf :: proc(b: ^Builder, kind: Node_Kind, span: Source_Span, text := Text{}) -> (Node_Id, bool) #optional_ok¶
-
add_leaf adds a closed node of kind with text (borrowed from the bank’s pool) and no children; it fails as begin_node does.
- core.add_source :: proc(ctx: ^Read_Context, name, text: string) -> (Source_Id, bool)¶
-
add_source registers text that is not a file, such as a configured prologue, so nodes parsed from it carry spans into it. The text must outlive the conversion.
- core.admonition_label :: proc(o: Render_Options, k: Admonition_Kind) -> string¶
-
admonition_label is the title of an admonition kind; „“ for a generic admonition.
- core.admonition_name :: proc(k: Admonition_Kind) -> string¶
-
admonition_name returns the static class name of an admonition kind („note“, „tip“).
- core.anchor_extras :: proc(a: ^Anchors, owner: Node_Id) -> []Anchor_Extra¶
-
anchor_extras returns the ids generated for a node’s sake (see Anchor_Extra), in the order they were given.
- core.anchor_ids :: proc(a: ^Anchors, id: Node_Id) -> Anchor_Ids¶
-
anchor_ids iterates every id of a node, the primary one first.
- core.anchor_of :: proc(a: ^Anchors, id: Node_Id) -> (string, bool)¶
-
anchor_of returns the primary id of a node, borrowed from the anchor table, or false when the node has none.
- core.arg_int :: proc(v: i64) -> Diagnostic_Arg¶
-
arg_int makes an integer diagnostic argument.
- core.arg_span :: proc(s: Source_Span) -> Diagnostic_Arg¶
-
arg_span makes a diagnostic argument that quotes the source text of s.
- core.arg_static :: proc(s: string) -> Diagnostic_Arg¶
-
arg_static makes a diagnostic argument of static text, which must outlive the reports.
- core.attribute :: proc(v: View, id: Node_Id, key: Attribute_Key) -> (string, bool)¶
-
attribute returns the value of node id’s first attribute with key, borrowed from the view, or false when it has none.
- core.attributes :: proc(v: View, id: Node_Id) -> Attributes¶
-
attributes starts an iteration over every attribute of node id, for next_attribute.
- core.begin_node :: proc(b: ^Builder, kind: Node_Kind, span: Source_Span) -> (Node_Id, bool) #optional_ok¶
-
begin_node opens a node of kind as the last child of the current node, to be closed with end_node. It fails, poisoning the builder and returning INVALID_NODE, when the nesting is illegal (child_allowed), a limit is reached, or the nodes region is full.
- core.buffer_string :: proc(b: ^Buffer) -> string¶
-
buffer_string returns the bytes written, borrowed from the buffer’s storage.
- core.buffer_write :: proc(b: ^Buffer, s: string)¶
-
buffer_write appends s, or sets overflow and drops it, and every later write, when it does not fit; wanted counts it either way.
- core.buffer_write_byte :: proc(b: ^Buffer, c: u8)¶
-
buffer_write_byte appends one byte, as buffer_write does.
- core.build_anchors :: proc(ctx: ^Render_Context, a: ^Anchors, headings: bool) -> Status¶
-
build_anchors takes its storage from the render context’s scratch. Identifiers are made from text in the snapshot’s pool, and folding never more than doubles its length, so twice the pool plus a fixed overhead per anchor always suffices. A node’s own name is gathered in room measured for the longest one.
- core.builder_capacity :: proc(b: ^Builder, region: Region, minimum: u64)¶
-
builder_capacity poisons the builder with a Capacity status whose need names region and the minimum it lacks, reporting CORE_CAPACITY; nothing happens if it already failed.
- core.builder_fail :: proc(b: ^Builder, d: Diagnostic)¶
-
builder_fail reports d and poisons the builder with its status (the first failure wins); later builder calls do nothing.
- core.builder_finish :: proc(b: ^Builder) -> Status¶
-
builder_finish closes the root. Every other node must already be closed.
- core.builder_init :: proc(b: ^Builder, snap: ^Snapshot, scratch: ^Scratch, reports: ^Reports, limits: Limits, root_span: Source_Span) -> Status¶
-
builder_init starts a builder over snap with its open-node stack taken from scratch, and opens the root Document node at root_span. The engine calls it for every read and pass; tests use it to drive a reader’s pieces. It returns Capacity, with b.need set, when scratch cannot hold the stack. The builder borrows every argument for one stage.
- core.cell_info :: proc(v: View, id: Node_Id) -> Cell_Info¶
-
cell_info returns the cell payload of node id, or a cell spanning one row and one column when it has none.
- core.check_render :: proc(ws: ^Workspace, doc: Document, renderer: Renderer, request: Request) -> Result¶
-
check_render runs the renderer in measure mode and reports its exact output size, as need, and every support problem, without writing. doc must be a valid document of ws.
- core.child_count :: proc(v: View, id: Node_Id) -> int¶
-
child_count counts the children of node id, in time linear in their number.
- core.children :: proc(v: View, id: Node_Id) -> Children¶
-
children starts an iteration over the children of node id, for next_child.
- core.code_caption :: proc(v: View, id: Node_Id) -> Node_Id¶
-
code_caption is a code block’s Caption child (its parsed Custom
caption), or INVALID_NODE when it has none.
- core.content_error :: proc(status: Status) -> bool¶
-
content_error tells whether an error’s status describes the content (an unknown directive or role, a bad option, an unresolved reference, content refused by policy) rather than a tree that cannot be used: capacity, limits, cancellation, or a bug. Policy.keep_documents_with_errors keeps documents whose errors are all content errors.
- core.content_model :: proc(k: Node_Kind) -> Content¶
-
content_model tells what children nodes of kind k may have; see child_allowed. The switch is exhaustive, so a new kind does not compile until it says.
- core.contents_scope :: proc(v: View, contents: Node_Id) -> (first, end: Node_Id, base: int)¶
-
contents_scope is the range of nodes a table of contents lists and the number of sections around that range.
- core.convert :: proc(ws: ^Workspace, registry: Registry, request: Request, output: []u8) -> Result¶
-
convert reads, optionally transforms, and renders one source into output, which the caller owns; on success output[:written] holds it, and on failure written is 0. It starts a new workspace generation, which invalidates every earlier document, even on failure. It checks the registry first (validate_registry). The result borrows the workspace: its reports are valid until the next conversion or reset. It never allocates; every failure is a status with a primary diagnostic.
- core.convert_text :: proc(ws: ^Workspace, registry: Registry, reader, renderer, text: string, name := "input") -> (string, Result)¶
-
convert_text converts text with default_request and the workspace’s own output region (set by the slab initializers; convert with an output slice otherwise). The returned string borrows that region and is valid until the next conversion or reset of the workspace; on failure it is „“ and the result says why.
- core.copy_payload :: proc(b: ^Builder, v: View, from, to: Node_Id)¶
-
copy_payload copies a node’s list, cell, or link row, with its texts, to the node to of b’s document; passes that rebuild a document share it.
- core.copy_subtree :: proc(b: ^Builder, v: View, id: Node_Id) -> Node_Id¶
-
copy_subtree copies a node and its descendants from a document view into a builder, including text, attributes, and payload rows, and returns the copy of id. Copies are appended in order, one per node, so the copy of a descendant d is copy + (d - id): a pass can adjust copies with set_value, set_text, add_flags, and set_kind. Internal link targets keep their numbering only when the pass copies the whole document in order. On failure the builder is poisoned and the result is INVALID_NODE.
- core.current :: proc(b: ^Builder) -> Node_Id¶
-
current returns the innermost open node, or INVALID_NODE when none is open.
- core.current_kind :: proc(b: ^Builder) -> Node_Kind¶
-
current_kind returns the kind of the innermost open node; Document when none is open.
- core.custom_attribute :: proc(v: View, id: Node_Id, name: string) -> (string, bool)¶
-
custom_attribute returns the value of node id’s Custom attribute named name, borrowed from the view, or false when it has none.
- core.decode_last_rune :: proc(s: string, end: int) -> (rune, int)¶
-
decode_last_rune decodes the UTF-8 character ending at byte end of s, as decode_rune.
- core.decode_rune :: proc(s: string, i: int) -> (rune, int)¶
-
decode_rune decodes the UTF-8 character starting at byte i of s and returns it with its width; an invalid byte decodes as the replacement character, width 1.
- core.default_limits :: proc() -> Limits¶
-
default_limits returns the documented limits by value; zero limits never mean unlimited.
- core.default_policy :: proc() -> Policy¶
-
default_policy returns the safe policy by value: raw content, unsafe URLs, and math the target cannot translate are refused; includes may be requested.
- core.default_read_options :: proc() -> Read_Options¶
-
default_read_options returns the read options by value: RST title promotion on, tab width 8, and no reader settings.
- core.default_request :: proc(name, text, reader, renderer: string) -> Request¶
-
default_request assembles a complete Request with the documented defaults: default_read_options, a standalone render, default_policy, and default_limits, with no passes, resource provider, or cancellation probe. It borrows name and text. Change fields afterwards; lib/defaults has typed read options for the built-in readers.
- core.diagnostic :: proc(m: Message, span: Source_Span, a := Diagnostic_Arg{}, b := Diagnostic_Arg{}) -> Diagnostic¶
-
diagnostic builds a Diagnostic by value from a static message, a span, and up to two arguments; it copies nothing.
- core.document_valid :: proc(doc: Document) -> bool¶
-
document_valid reports whether doc still names the snapshot it was built as: the same generation, the active bank, and the bank’s revision at that time.
- core.dump_tree :: proc(v: View, e: ^Emitter)¶
-
dump_tree writes a readable, deterministic outline of a document. Tests use it as a renderer-independent golden format:
document section value=1 heading value=1 text "Title"
- core.emit :: proc(e: ^Emitter, s: string)¶
-
emit writes s: Measure mode counts it, Write mode also stores it in the output.
- core.emit_mark :: proc(e: ^Emitter, span: Source_Span)¶
-
emit_mark records that output from here on originates at span.
- core.encode_rune :: proc(r: rune) -> ([4]u8, int)¶
-
encode_rune returns r encoded as UTF-8 and the number of bytes used.
- core.end_node :: proc(b: ^Builder, id: Node_Id)¶
-
end_node closes id, which must be the innermost open node, and records its subtree end; closing out of order poisons the builder.
- core.extension_as :: proc(e: Read_Extension, $T: typeid) -> (settings: ^T, ok: bool)¶
-
extension_as returns the settings e carries as ^T: nil and true when e is empty, nil and false when it carries another type. It neither reports nor allocates.
- core.extra_anchor :: proc(a: ^Anchors, owner, item: Node_Id) -> (string, bool)¶
-
extra_anchor returns the id of an element generated for owner and item.
- core.extra_text :: proc(a: ^Anchors, e: Anchor_Extra) -> string¶
-
extra_text is the id of a generated element.
- core.find_reader :: proc(r: Registry, id: string) -> (Reader, bool)¶
-
find_reader returns the reader of r with id, by value, or false.
- core.find_renderer :: proc(r: Registry, id: string) -> (Renderer, bool)¶
-
find_renderer returns the renderer of r with id, by value, or false.
- core.first_child :: proc(v: View, id: Node_Id) -> Node_Id¶
-
first_child returns the first child of node id, or INVALID_NODE when it has none.
- core.first_problem :: proc(r: ^Reports) -> Diagnostic¶
-
first_problem returns the primary error, or the first warning when there is none.
- core.has_children :: proc(v: View, id: Node_Id) -> bool¶
-
has_children tells whether node id has any child.
- core.has_class :: proc(v: View, id: Node_Id, class: string) -> bool¶
-
has_class looks through every class attribute; a value may hold several classes.
- core.id_fold :: proc(r: rune) -> string¶
-
id_fold is the ASCII transliteration make_id gives a lowercase rune („é“ gives „e“, „²“ gives „2“), from Unicode’s decompositions, or „“ when it has none. The string is static.
- core.include_source :: proc(ctx: ^Read_Context, from: Source_Id, name: string, span: Source_Span, use := Source_Use.Parsed) -> (Source_Id, bool)¶
-
include_source asks the host for a resource named by a directive in source from, records it in the source table, and returns its ID. Every refusal is reported at span. use says whether the reader parses the text or shows it as it is.
- core.init_workspace :: proc(ws: ^Workspace, storage: Storage) -> Result¶
-
init_workspace borrows storage. It checks alignment-free invariants: every region is disjoint, and bank A can hold at least a root node. Initializing a workspace again invalidates every document of its earlier storage.
- core.init_workspace_from_bytes :: proc(ws: ^Workspace, slab: []u8) -> Result¶
-
init_workspace_from_bytes carves the regions of slab_plan(estimate) from slab, one bank, for the largest input estimate whose plan fits, and initializes the workspace. The workspace borrows slab, which must outlive it; a slab too small for any plan is a capacity result. For passes that rebuild, use init_workspace_with_plan.
- core.init_workspace_with_plan :: proc(ws: ^Workspace, slab: []u8, p: Slab_Plan) -> Result¶
-
init_workspace_with_plan carves exactly the regions of p from slab, and the rest of the slab becomes scratch. It is the authoritative path: init_workspace_from_bytes only chooses a plan. A plan that cannot be sized is Invalid_Input; a slab smaller than plan_bytes(p) is a capacity result.
- core.is_ascii_alnum :: proc(c: u8) -> bool¶
-
is_ascii_alnum tells whether c is an ASCII letter or digit.
- core.is_ascii_digit :: proc(c: u8) -> bool¶
-
is_ascii_digit tells whether c is an ASCII digit.
- core.is_ascii_punct :: proc(c: u8) -> bool¶
-
is_ascii_punct tells whether c is ASCII punctuation, as CommonMark defines it.
- core.is_ascii_space :: proc(c: u8) -> bool¶
-
is_ascii_space tells whether c is ASCII white space: space, tab, LF, CR, FF, or VT.
- core.is_unicode_punctuation :: proc(r: rune) -> bool¶
-
is_unicode_punctuation follows CommonMark 0.31: general categories P and S.
- core.is_unicode_whitespace :: proc(r: rune) -> bool¶
-
is_unicode_whitespace follows CommonMark: Zs characters, tab, LF, FF, and CR.
- core.kept_message :: proc(policy: Policy, m: Message) -> Message¶
-
kept_message is m as a renderer reports it: a content error becomes a warning when the policy keeps documents with errors, so the page is still written.
- core.kind_name :: proc(k: Node_Kind) -> string¶
-
kind_name returns the static name of a node kind, as dumps and diagnostics write it.
- core.label :: proc(o: Render_Options, l: Label) -> string¶
-
label returns a label in the render’s language, or in English when it has none.
- core.line_bounds :: proc(text: string, offset: int) -> (start, end: int)¶
-
line_bounds returns the byte range of the line containing offset, without the break.
- core.line_column :: proc(text: string, offset: int) -> (line, column: int)¶
-
line_column converts a byte offset into a 1-based line and byte column.
- core.link_info :: proc(v: View, id: Node_Id) -> (Link_Info, bool)¶
-
link_info returns the link payload of node id, or false and an unresolved link when it has none.
- core.list_info :: proc(v: View, id: Node_Id) -> List_Info¶
-
list_info returns the list payload of node id, or a bullet list starting at 1 when it has none.
- core.load_object :: proc(ws: ^Workspace, bytes: []u8, limits: Limits) -> Read_Result¶
-
load_object rebuilds a document from bytes written by write_object into bank A of a new workspace generation. bytes must outlive the document: source names and texts are views into them.
- core.make_id :: proc(out: ^Buffer, name: string)¶
-
make_id turns a name into an identifier matching [a-z](-?[a-z0-9]+)*: letters are lowercased and transliterated to ASCII (ID_FOLDS, derived from Unicode data), every other run of characters becomes one hyphen, and leading digits and hyphens are dropped, as published Sphinx URLs expect. The result may be empty.
- core.media_kind :: proc(path: string) -> Media_Kind¶
-
media_kind reads a path’s extension, ignoring case, a query, and a fragment.
- core.next_anchor_id :: proc(a: ^Anchors, it: ^Anchor_Ids) -> (string, bool)¶
-
next_anchor_id returns the next id of an anchor_ids iteration, borrowed from the anchor table; false ends it.
- core.next_attribute :: proc(v: View, it: ^Attributes) -> (Attribute, bool)¶
-
next_attribute returns the next attribute of an attributes iteration, whose Text values index the view’s pool; false ends it.
- core.next_child :: proc(v: View, it: ^Children) -> (Node_Id, bool)¶
-
next_child returns the next child of a children iteration; false ends it.
- core.nfd_first :: proc(s: string) -> rune¶
-
nfd_first returns the first character of s in NFD, as Sphinx takes an index entry’s letter: unicodedata.normalize(„NFD“, s[0])[0].
- core.no_reader_settings :: proc(ctx: ^Read_Context) -> bool¶
-
no_reader_settings is reader_settings for a reader that takes no settings: any extension is reported (CORE_SETTINGS_NONE) and the result is false.
- core.node_count :: proc(v: View) -> int¶
-
node_count returns the number of nodes in the document, the root included.
- core.node_text :: proc(v: View, id: Node_Id) -> string¶
-
node_text returns the text of node id, borrowed from the view.
- core.normalize_label :: proc(out: ^Buffer, label: string)¶
-
normalize_label writes the case-folded label with runs of white space collapsed to one space and the ends trimmed. It is used for CommonMark labels and RST names.
- core.normalize_nfd_into :: proc(dst: []u8, s: string) -> (n: int, ok: bool) #optional_ok¶
-
normalize_nfd_into writes s in Normalization Form D into dst, the caller’s storage, and returns the length of the whole normal form. It never allocates and never borrows s: the result is always dst[:n]. When dst is too small, ok is false, n is the size dst needs, and dst holds only a prefix; a nil dst measures.
- core.offset_in :: proc "contextless" (outer, inner: string) -> (int, bool)¶
-
offset_in returns where inner starts in outer when inner is a slice of outer’s bytes, and false otherwise (an empty inner included). It compares addresses only and reads neither string, so it is safe for any two strings.
- core.parent_of :: proc(v: View, id: Node_Id) -> Node_Id¶
-
parent_of scans backwards; it is linear and meant for diagnostics, not traversal.
- core.plain_text :: proc(v: View, id: Node_Id, out: ^Buffer)¶
-
plain_text writes the concatenated text of a subtree, as used for alt text and ids.
- core.plan_bytes :: proc(p: Slab_Plan) -> (bytes: int, ok: bool) #optional_ok¶
-
plan_bytes returns the slab size a plan needs. ok is false when a capacity is negative or the size overflows, which init_workspace_with_plan reports.
- core.pool_string :: proc(b: ^Builder, t: Text) -> string¶
-
pool_string returns the text t of the builder’s pool; it borrows the bank for the stage.
- core.pop :: proc(s: ^Stack($T)) -> (v: T, ok: bool)¶
-
pop removes and returns the top item; false when the stack is empty.
- core.push :: proc(s: ^Stack($T), v: T) -> bool¶
-
push appends v; false, changing nothing, when the stack is full.
- core.read_document :: proc(ws: ^Workspace, reader: Reader, request: Request) -> Read_Result¶
-
read_document parses the request’s source into bank A of a new generation and validates it. The document borrows the workspace and the request’s source text, which must outlive it; it is valid until the next conversion, reset, or rebuild of bank A, and is returned only on success.
- core.read_extension :: proc(settings: ^$T) -> Read_Extension¶
-
read_extension wraps a pointer to a reader’s settings with their type. It borrows settings, which must outlive the read.
- core.reader_settings :: proc(ctx: ^Read_Context, $T: typeid) -> (settings: ^T, ok: bool)¶
-
reader_settings is extension_as at a reader’s entry: settings of another type are reported (CORE_SETTINGS_TYPE, naming both types‘ packages) and ok is false; the reader then returns Invalid_Input before reading anything. nil and true mean the defaults.
- core.render_document :: proc(ws: ^Workspace, doc: Document, renderer: Renderer, request: Request, output: []u8) -> Result¶
-
render_document checks and measures, then writes into the caller’s output only if it fits; otherwise the result is Capacity with the exact size needed, and output is untouched. doc must be a valid document of ws, and stays valid.
- core.report :: proc(r: ^Reports, d: Diagnostic)¶
-
report records a diagnostic. The first error is kept by value in primary even when storage is full, so capacity failures remain explainable.
- core.report_message :: proc(r: ^Reports, m: Message, span: Source_Span, a := Diagnostic_Arg{}, b := Diagnostic_Arg{})¶
-
report_message reports the message m at span with its arguments, as report does.
- core.reset_workspace :: proc(ws: ^Workspace)¶
-
reset_workspace invalidates every document and clears all used-counts.
- core.resolve_link :: proc(b: ^Builder, row: u32, target: Node_Id, kind: Link_Kind, destination := Text{})¶
-
resolve_link records the resolution of a link row during a reader’s resolve stage.
- core.scratch_buffer :: proc(s: ^Scratch, n: int) -> (b: Buffer, missing: u64, ok: bool)¶
-
scratch_buffer takes a Buffer of n bytes from scratch, usually the wanted count of a measuring pass into a zero Buffer; ok is false, with the bytes missing, when scratch cannot hold it. The caller releases the scratch.
- core.scratch_mark :: proc(s: ^Scratch) -> Scratch_Mark¶
-
scratch_mark records how much scratch is taken, for scratch_release.
- core.scratch_release :: proc(s: ^Scratch, m: Scratch_Mark)¶
-
scratch_release gives back every scratch item taken since m; slices taken after m must not be used afterwards.
- core.scratch_take :: proc(s: ^Scratch, $T: typeid, n: int) -> (items: []T, missing: u64, ok: bool)¶
-
scratch_take returns n zeroed elements of T, or ok = false with the bytes missing.
- core.set_cell :: proc(b: ^Builder, id: Node_Id, info: Cell_Info)¶
-
set_cell stores info as node id’s cell payload; a full cells region poisons the builder with Capacity.
- core.set_kind :: proc(b: ^Builder, id: Node_Id, k: Node_Kind)¶
-
set_kind changes the kind of node id, as a pass does to a copy; validation checks the result. Nothing happens once the builder has failed.
- core.set_link :: proc(b: ^Builder, id: Node_Id, info: Link_Info) -> u32¶
-
set_link stores info as node id’s link payload and returns its row, for resolve_link, or NONE when the builder has failed or the links region is full (Capacity).
- core.set_list :: proc(b: ^Builder, id: Node_Id, info: List_Info)¶
-
set_list stores info as node id’s list payload; a full lists region poisons the builder with Capacity.
- core.set_span_end :: proc(b: ^Builder, id: Node_Id, end: u32)¶
-
set_span_end moves the end of node id’s source span, as a reader learns where a construct ends; nothing happens once the builder has failed.
- core.set_text :: proc(b: ^Builder, id: Node_Id, t: Text)¶
-
set_text sets the text of node id; nothing happens once the builder has failed.
- core.set_value :: proc(b: ^Builder, id: Node_Id, v: i32)¶
-
set_value sets the value of node id (a heading level, a list count, and so on); nothing happens once the builder has failed.
- core.slab_plan :: proc(input_bytes: int, second_bank := false) -> (p: Slab_Plan, ok: bool) #optional_ok¶
-
slab_plan estimates capacities for an input of the given size. The estimate is generous for prose and typical technical documents; tables and heavy markup may need more, which a capacity result reports. ok is false when a capacity would overflow.
- core.source_entry :: proc(v: View, id: Source_Id) -> Source_Entry¶
-
source_entry returns the source-table entry of id (the main source is 0), borrowed from the view, or a zero entry when id is out of range.
- core.source_of :: proc(ctx: ^Read_Context, id: Source_Id) -> string¶
-
source_of returns the text of source id, borrowed from the workspace’s source table for the read.
- core.source_text :: proc(v: View, span: Source_Span) -> string¶
-
source_text returns the source bytes a span covers, or „“ for an invalid span.
- core.spend :: proc(b: ^Builder, steps: u64 = 1) -> bool¶
-
spend charges work against limits.max_work and polls cancellation periodically.
- core.split_label :: proc(s: string) -> (before, after: string)¶
-
split_label splits a label at its „%s“: the text before and after the value.
- core.stack_diagnostic :: proc(g: Stack_Guard, span: Source_Span) -> Diagnostic¶
-
stack_diagnostic is the Limit a guard’s recursion reports.
- @(require_results) core.stack_exhausted :: proc "contextless" (g: Stack_Guard) -> bool¶
-
stack_exhausted reports whether the next frame would take the stack past the budget. A zero guard (never started) is never exhausted.
- @(require_results, no_sanitize_address) core.stack_guard :: proc "contextless" (limits: Limits) -> Stack_Guard¶
-
stack_guard starts measuring at the caller’s frame, with the limits‘ stack budget.
- core.stack_slice :: proc(s: ^Stack($T)) -> []T¶
-
stack_slice returns the items in the stack, bottom first, borrowed from its storage.
- core.subtree_end :: proc(v: View, id: Node_Id) -> Node_Id¶
-
subtree_end returns the id after the last descendant of node id.
- core.symbol_get :: proc(t: ^Symbol_Table, key: string) -> (value: u32, found: bool)¶
-
symbol_get returns the value stored for key, or NONE and false when it is absent.
- core.symbol_put :: proc(t: ^Symbol_Table, key: string, value: u32) -> (existing: u32, status: Symbol_Status)¶
-
symbol_put inserts key. For a duplicate it leaves the table unchanged and returns the existing value.
- core.symbol_set :: proc(t: ^Symbol_Table, key: string, value: u32) -> bool¶
-
symbol_set replaces the value of an existing key.
- core.symbol_table_init :: proc(t: ^Symbol_Table, s: ^Scratch, capacity: int) -> (missing: u64, ok: bool)¶
-
symbol_table_init takes 2 * capacity slots (rounded to a power of two) from scratch.
- core.text :: proc(v: View, t: Text) -> string¶
-
text returns the string t names in the snapshot’s text pool, borrowed from the view.
- core.text_close :: proc(b: ^Builder, start: u32) -> Text¶
-
text_close returns the Text pushed since start (text_open), or an empty Text when the builder has failed.
- core.text_open :: proc(b: ^Builder) -> u32¶
-
text_open starts a run of pushed text: the offset text_close measures from.
- core.text_push :: proc(b: ^Builder, s: string)¶
-
text_push copies s into the text pool; a full pool poisons the builder with Capacity.
- core.text_push_byte :: proc(b: ^Builder, c: u8)¶
-
text_push_byte copies one byte into the text pool, as text_push does.
- core.text_push_rune :: proc(b: ^Builder, r: rune)¶
-
text_push_rune copies r, UTF-8 encoded, into the text pool, as text_push does.
- core.text_rewind :: proc(b: ^Builder, start: u32)¶
-
text_rewind drops text pushed since start; used when a tentative parse is abandoned.
- core.top :: proc(s: ^Stack($T)) -> ^T¶
-
top returns a pointer to the top item, valid until the next push or pop, or nil when the stack is empty.
- core.transform_document :: proc(ws: ^Workspace, doc: Document, passes: []Pass, limits := Limits{}) -> Read_Result¶
-
transform_document runs passes in order. A rebuilding pass writes the inactive bank, which is validated before it becomes active; on failure the old bank stays valid and is returned as the document. A workspace without a second bank fails before a pass runs, with Capacity and need.region Second_Bank. doc must be a valid document of ws. Zero limits mean default_limits.
- core.trusted_policy :: proc() -> Policy¶
-
trusted_policy suits conformance tests and content the caller wrote.
- core.unwrap_node :: proc(b: ^Builder, id: Node_Id)¶
-
unwrap_node removes a closed node and keeps its descendants in place, as when an RST section becomes the document title. Links that resolved to the removed node resolve to the node that takes its index. Validation still runs after the reader finishes.
- core.validate :: proc(snap: ^Snapshot, sources: []Source_Entry, scratch: ^Scratch, limits: Limits) -> (Status, Diagnostic)¶
-
validate checks every structural invariant of a finished snapshot. It needs a stack of open subtree ends, taken from scratch and released before returning.
- core.validate_registry :: proc(r: Registry) -> Result¶
-
validate_registry checks that every adapter has an ID, a version, and a procedure, and that no ID is registered twice. convert checks its registry the same way before using it, so a bad registry fails with Invalid_Input instead of the first match silently winning; a host may call this once where it builds a registry.
- core.view :: proc(doc: Document) -> (View, bool)¶
-
view checks doc once (document_valid) and returns its read-only View, which borrows the workspace until doc becomes invalid; false for a stale or foreign handle.
- core.workspace_size :: proc(input_bytes: int) -> (bytes: int, ok: bool) #optional_ok¶
-
workspace_size returns the slab size, in bytes, of slab_plan(input_bytes): one bank, for conversions without rebuilding passes. ok is false when the size cannot be represented. Size a workspace for passes with a plan (see above).
- core.write_id :: proc(out: ^Buffer, name: string)¶
-
write_id lowercases letters, keeps letters and digits, and joins every other run of characters with one hyphen. It names documents and chapters, whose names may start with digits; make_id names anchors.
- core.write_object :: proc(v: View, e: ^Emitter)¶
-
write_object serializes the document in view v. Use Measure mode first for its size.
Constants
- core.BUILDER_OPEN :: max(u32) - 1¶
- core.CORE_CAPACITY¶
- core.CORE_DEPTH¶
- core.CORE_NODES¶
- core.CORE_STACK¶
- core.CORE_UNHANDLED_KIND¶
- core.CORE_WORK¶
- core.DEFAULT_STACK_BYTES :: (512 << 10) * ASAN_FRAME_SCALE¶
-
DEFAULT_STACK_BYTES is the stack a reader or renderer may use when Limits.stack_bytes is 0. It holds the default max_depth of every recursive path with room to spare, and with STACK_RESERVE it fits a 1 MiB thread, the smallest default stack of the supported platforms‘ threads (Windows; Odin’s threads on Unix take RLIMIT_STACK, usually 8 MiB).
- core.INCLUDE_MISSING¶
- core.NONE :: max(u32)¶
- core.SCHEMA_VERSION :: 1¶
- core.STACK_RESERVE :: (128 << 10) * ASAN_FRAME_SCALE¶
-
STACK_RESERVE is the stack a conversion needs below its deepest guard.
- core.VERSION :: "0.2.0"¶
-
VERSION is the engine’s version. It is released with Guidedog and so far follows its version (cli.VERSION), but is kept apart because programs embed the engine without the command. SCHEMA_VERSION counts the incompatible changes to documents saved as objects.
Variables
- @(rodata) core.ENGLISH_LABELS¶
-
ENGLISH_LABELS are the labels in English, Sphinx’s msgids; renderers fall back to them.
- @(rodata) core.LIST_STYLE_NAMES¶