Expand description
Textlane is a Rust-native text processing pipeline: a unified replacement whose plugins run natively, with Node.js and Python bindings over the same crate.
Re-exports§
pub use textlane_html as html;pub use textlane_md as md;pub use textlane_mdx as mdx;pub use textlane_nl as nl;
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.
- Arena
Vec - 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
codeand a message for people. - File
- The document a pipeline processes: where it came from and what plugins reported about it.
- Finished
- A finished run: what it produced and the file plugins reported against.
- Frozen
Processor - A processor whose plugins are attached: it runs any number of documents, in parallel.
- Html
Target - 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.
- Natural
Language Parser Slot - 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. - Output
- What processing one document produced: the output and the kind of text it is.
- Pause
- A run stopped before consecutive host stages: the binding runs each of
hostsovertree, in order, and hands the result toresume. - Pipeline
- A processor built from plugin names and JSON options, with unified’s
use,dataandfreezesemantics: what the bindings drive, and Rust code mixing its own plugins in. - Point
- A place in the source: a byte offset, plus the virtual spaces into a tab it sits at.
- Process
Job - A frozen pipeline’s
process, independent of thePipelineit came from. - Processor
- A pipeline being composed:
.with()adds a plugin, as unified’s.use()does. - Quote
Characters - The quote characters to use for double and single quotes.
- Resolved
Url - A relative or root-relative URL resolved to the file it names inside a site.
- Script
Error - 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.
- Script
Expression - 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.
- Script
Parser Slot - The slot holding the script parser
md.mdxvalidates JavaScript with; the textlane processor seeds it when built withmdx. Without one, expressions end at the brace that balances their opening one and imports and exports at a blank line. - Script
Statement - 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. - Typographer
Slot - The slot holding the typographer
md.smartypantsuses; the textlane processor seeds it when built withnl. - Typography
- What a
Typographerreplaces, as retext-smartypants’ options name it. - Unist
Point - A point as unist writes it.
- Unist
Position - A position as unist writes it: lines and columns from 1, offsets in UTF-16 code units.
Enums§
- Api
- Whether a call may finish asynchronous stages, as unified’s
processandrundo, or must fail on them, asprocessSyncandrunSyncdo. - Backticks
- How smartypants treats backticks:
false,trueor'all'. - Dashes
- How smartypants treats dashes:
false,true,'oldschool'or'inverted'. - Data
- unist’s
data: whatever JSON a plugin attached to a node, kept as it is. - Ellipses
- How smartypants treats dots:
false,true,'spaced'or'unspaced'. - Outcome
- What a run produced: the tree, from
start_run, or the text, fromstart_process. - 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.
- Progress
- How far a run of a pipeline got: to its end, or to stages a binding must run.
- Step
- What starting a stage gives: its tree, or a job that yields it.
- Tree
- The tree a pipeline stage takes or returns.
- Tree
Kind - Which kind of tree a stage takes or returns, checked when a processor freezes.
Traits§
- Compiler
- Turns a tree into output text, whose kind
extensionnames (html,md). - Html
Writer - Writes HTML straight from a tree, or
Noneto have the stages run as declared. - Natural
Language Parser - 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.
- Script
Parser - A JavaScript parser, as acorn is to micromark’s MDX extensions:
md.mdxasks 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.
- Typographer
- Typographic punctuation for text, as retext-smartypants gives it: what
md.smartypantsasks the natural-language plugins for.
Functions§
- create_
slug - Lowercase, drop punctuation and symbols, turn spaces into dashes.
- find_
gemoji_ shortcodes - The
:name:shortcodes gemoji knows invalue, each(start, end, emoji), found as remark-gemoji’s/:(\+1|[-\w]+):/gfinds them; an unknown name is retried from its next character, so its closing colon can open the next shortcode. - list_
plugins - The name of every public plugin this build carries, as a pipeline names it.
- prefix_
base baseonce before a root-relative URL: never twice, nothing for/or none.- read_
gemoji_ label - A shortcode’s name as remark-emoji labels it: each
_, and each-not before1, as a space. - read_
messages - Read the messages a binding’s plugins reported, each
{reason, ruleId?, source?, place?}as vfile-message has it, its place a point or a position. - read_
retained_ memory - The most memory, in bytes, each thread keeps after a document to reuse for the next.
- read_
switch - A switch upstream reads as
!== false:nulland a missing option meantrue. - read_
version - The crate’s version, which every binding reports as its own.
- resolve_
url - Resolve
url, written in the file atpath, to the file it names insideroot;Nonefor a URL with a scheme, protocol-relative, holding a backslash, a control character or surrounding space, or a fragment alone, or a relative one without a file to resolve it against or resolving outsideroot. - set_
retained_ memory - Cap the memory, in bytes, each thread keeps after a document to reuse for the next;
0keeps none. - write_
file - The file a binding’s
processhands back, shaped as a vfile:{value, messages, data}, each message{reason, ruleId, source, place}in the order plugins reported them. - write_
messages - Messages as a vfile holds them, each
{reason, ruleId, source, place}, in order.
Type Aliases§
- Arena
String - 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.