Technical previewShare feedback

Search

Search documentation

Getting started

Updated Nov 1, 2026

Install

pip install textlane

The wheel carries a prebuilt extension for your platform, so no Rust toolchain is needed. Wheels cover Linux on glibc (manylinux) and musl (musllinux, Alpine), macOS and Windows, each on x64 and arm64, for Python 3.9 or later.

A first pipeline

A pipeline parses text into a tree, runs plugins over it and serializes the result. Each plugin is a function in its domain's module: textlane.md, textlane.html, textlane.mdx and textlane.nl.

from textlane import html, md, textlane

file = (
    textlane()
    .use(md.parse())
    .use(md.to_html())
    .use(html.stringify())
    .process("# Hello *world*")
)
file["value"]
# <h1>Hello <em>world</em></h1>

md.parse reads Markdown into mdast, md.to_html turns it into hast and html.stringify writes HTML. process returns the file; await processor.aprocess(text) is its coroutine form.

Adding syntax

Syntax extensions sit beside the parser. Add md.gfm for tables, task lists, strikethrough and autolinks, md.cjk_friendly for emphasis next to Chinese, Japanese and Korean text, and md.frontmatter to read a YAML block at the top:

from textlane import html, md, textlane

file = (
    textlane()
    .use(md.parse())
    .use(md.gfm())
    .use(md.frontmatter())
    .use(md.to_html())
    .use(html.stringify())
    .process("---\ntitle: Notes\n---\n\n~~draft~~ done")
)
file["value"]
# <p><del>draft</del> done</p>

Reading the result

The file is a dict holding the output as value, the messages plugins reported and the data they set. Checks such as nl.repeated_words leave the text alone and report a message:

from textlane import md, nl, textlane

file = (
    textlane()
    .use(md.parse())
    .use(md.to_natural_language())
    .use(nl.repeated_words())
    .use(nl.stringify())
    .process("It is the the best.")
)
file["messages"][0]["reason"]
# Unexpected repeated `the`, remove one occurrence

Next, the processor covers every method, and the plugin pages list each plugin with its options.

Created with ❤ and Livemark