Skip to main content

Crate textlane_core

Crate textlane_core 

Source
Expand description

Textlane’s core: the unist conventions and the mdast, hast and nlcst nodes built on them, the file a pipeline reads and reports diagnostics against, and the plugin contract every crate shares.

Modules§

hast
The hast nodes: HTML’s syntax tree.
mdast
The mdast nodes: Markdown’s syntax tree.
nlcst
The nlcst nodes: natural language’s syntax tree.

Structs§

Allocator
The arena every node of one document is allocated in. An arena to bump allocate into.
ArenaVec
A vector allocated in a document’s arena that never drops its items.
Attach
What plugins register while a processor freezes.
Error
A failure that stops a pipeline: a stable code and a message for people.
File
The document a pipeline processes: where it came from and what plugins reported about it.
HtmlTarget
What an HTML compiler writes that a stage writing HTML itself must match.
Lines
The line starts of a source, to turn byte points into unist’s UTF-16 lines and columns.
Location
A source indexed as vfile-location reads it: offsets in UTF-16 code units, turned into lines, columns and the byte points of core’s positions, each in constant or log time.
Message
A diagnostic a plugin reported, as vfile-message does.
NaturalLanguageParserSlot
The slot holding the natural-language parser bridges into nlcst read when their stage is built; the textlane processor seeds it with nl.parse’s Latin parser before plugins attach.
Point
A place in the source: a byte offset, plus the virtual spaces into a tab it sits at.
ScriptError
A syntax error: the byte span of what the parser stopped at, which ends at the end of the source when more source might still make it valid.
ScriptExpression
What an expression is, as far as MDX checks it: the byte offset where it ends, before any comments after it, and, for an object literal (parentheses dropped), the ESTree type and byte offset of each property.
ScriptParserSlot
The slot holding the script parser md.mdx validates JavaScript with; the textlane processor seeds it when built with mdx. Without one, expressions end at the brace that balances their opening one and imports and exports at a blank line.
ScriptStatement
A top-level statement of a module: its ESTree type, where it starts and, for an import, the local names it declares.
Slots
Data plugins share while attaching, one value per type.
Slugger
github-slugger’s BananaSlug: slugs, made unique by counting repeats.
UnistPoint
A point as unist writes it.
UnistPosition
A position as unist writes it: lines and columns from 1, offsets in UTF-16 code units.

Enums§

Data
unist’s data: whatever JSON a plugin attached to a node, kept as it is.
Position
Where a node sits: a span of the current source, or a unist position that does not point into it, such as one a foreign plugin set or one read from a serialized tree.
Step
What starting a stage gives: its tree, or a job that yields it.
Tree
The tree a pipeline stage takes or returns.
TreeKind
Which kind of tree a stage takes or returns, checked when a processor freezes.

Traits§

Compiler
Turns a tree into output text, whose kind extension names (html, md).
HtmlWriter
Writes HTML straight from a tree, or None to have the stages run as declared.
NaturalLanguageParser
A natural-language parser, as parse-latin’s instance is to mdast-util-to-nlcst and hast-util-to-nlcst: bridges into nlcst tokenize text with it and run its plugins.
Parser
Turns input text into a tree.
Plugin
A pipeline stage: attached once when a processor freezes, where it registers what it does.
ScriptParser
A JavaScript parser, as acorn is to micromark’s MDX extensions: md.mdx asks it where an expression or a block of imports and exports is valid, and keeps only the source.
Transform
Changes a tree, or bridges it into another kind of tree.

Functions§

create_slug
Lowercase, drop punctuation and symbols, turn spaces into dashes.

Type Aliases§

ArenaString
A string allocated in a document’s arena, while it is being built.
Job
Deferred work a stage hands back, finished only by the asynchronous API.