Skip to main content

Crate textlane_html

Crate textlane_html 

Source
Expand description

Textlane’s HTML plugins: parsing, hast transforms, sanitizing and serializing.

Structs§

ExternalLinks
html.externalLinks: rel, target and more on links to other sites, as rehype-external-links adds them; options named as it names them, JSON values only.
ExtractToc
html.extractToc: the headings, nested by rank, as the file’s data.toc, as @stefanprobst/rehype-extract-toc stores them.
Format
html.format: indent and collapse whitespace for readable HTML; options named as hast-util-format names them.
Highlight
html.highlight: code blocks colored as Shiki colors them, natively by giallo; options named as @shikijs/rehype names them.
Katex
html.katex: math rendered as rehype-katex renders it, natively by katex-rs; options named as KaTeX names them.
Parse
html.parse: HTML into hast; options named as rehype-parse names them.
Raw
html.raw: reparse raw HTML and fix nesting through the HTML parser; options named as hast-util-raw names them.
Sanitize
html.sanitize: keep only what a schema allows; options: hast-util-sanitize’s schema, where a field left out keeps the default schema’s, which is GitHub’s.
Slug
html.slug: ids on headings, from their text; options named as rehype-slug names them.
Stringify
html.stringify: hast into HTML; options named as hast-util-to-html names them.
ToMarkdown
html.toMarkdown: hast into mdast; options named as hast-util-to-mdast names them.
ToNaturalLanguage
html.toNaturalLanguage: hast into nlcst, tokenized by the processor’s natural-language parser.
UnwrapImages
html.unwrapImages: paragraphs that hold only images, and links around them, give way to their content, as rehype-unwrap-images does.

Enums§

AttributeDefinition
A property a sanitize schema allows: by name, or a name and its allowed values.
Classes
Class names: a list, or one string of them separated by white space.
ColorReplacement
A replacement color, or a theme’s own replacements.
ConfiguredTransformer
A transformer with its options, as @shikijs/transformers names them.
HighlightTransformer
A transformer of @shikijs/transformers: its name alone, or its name and options.
Indent
One level of indentation.
InlineCode
How inline code names its language.
KatexOutput
The markup KaTeX writes.
KatexStrict
How strictly KaTeX holds input to LaTeX.
KatexStrictMode
One level of KaTeX’s strictness.
Primitive
A primitive property value.
Tokens
Tokens: a list, or one string of them separated by white space.
TransformerName
The transformers html.highlight runs natively.

Functions§

bridge_hast
hast into nlcst, as hast-util-to-nlcst does: each paragraph or heading, and each run of phrasing content in an element that accepts flow, becomes a paragraph, with source the text the tree was parsed from.
convert_hast
Turn hast into mdast, as hast-util-to-mdast does after collapsing whitespace as rehype-minify-whitespace does; several nodes come back in a root.
extract_toc
The headings of a tree as @stefanprobst/rehype-extract-toc nests them: each {depth, value, id?, children?}, under the closest heading of a lower rank before it.
format_hast
Format whitespace in a hast tree for reading, as hast-util-format does: collapse it, then put each block on its own line, indented by how deep it nests.
highlight_hast
Color each <pre> whose first child is a <code class="language-…"> as @shikijs/rehype does, replacing the block with Shiki’s.
mark_external_links
Mark each link to another site as rehype-external-links does: its properties, rel, target and appended content, in that order.
parse_html
Parse HTML into hast as parse5 and hast-util-from-html do, recording parse errors on file when emit_parse_errors is set.
raw_hast
Pass a hast tree through the HTML parser, as hast-util-raw does: raw nodes become real nodes and nesting is fixed.
sanitize_hast
Keep only what a schema allows of a hast tree, as hast-util-sanitize does.
slug_hast
Give headings without an id one made from their text, as rehype-slug does.
stringify_hast
Serialize hast as HTML, as hast-util-to-html does.
typeset_hast
Render each element of class language-math, math-display or math-inline with KaTeX as rehype-katex does; a <pre> around a language-math <code> is replaced whole.
unwrap_images
Put the content of each paragraph that holds only images, links around them and white space in its place, as rehype-unwrap-images does.