Patitas API Reference

Browse Python API documentation by package.

Packages

Modules

cache

Content-addressed parse cache for Patitas. Provides (content_hash, config_hash) -> Document caching to avoid...

config

ContextVar-based parse configuration for Patitas. Provides thread-local configuration using Python's ContextVars...

context

Content-aware context mapping for Patitas AST nodes. Maps AST node types to the template context paths they affect.

differ

AST differ — structural diff on Patitas frozen ASTs. Compares two Patitas Document trees and produces a changeset...

errors

Exception classes for Patitas.

excerpt

Extract plain-text excerpts from Patitas AST. Provides structurally correct excerpt extraction that stops at block...

highlighting

Syntax highlighting protocol and injection for Patitas. Provides optional syntax highlighting for code blocks. When...

icons

Icon resolver protocol and injection for Patitas. Provides optional icon support for directives.

incremental

Incremental re-parsing for Patitas ASTs. When a user edits one paragraph, only that paragraph's region...

location

Source location tracking for error messages and debugging.

nodes

Typed AST nodes for Patitas.

notebook

Jupyter notebook (.ipynb) parser for Patitas. Parses nbformat 4.x JSON to (markdown_content, metadata) in the same...

parser

Recursive descent parser producing typed AST.

patitas

Patitas — Modern Markdown Parser for Python 3.14t A CommonMark-compliant Markdown parser designed for free-threaded...

profiling

Patitas ParseAccumulator — opt-in profiling for Markdown parsing.

protocols

Protocols for Patitas.

serialization

AST serialization — JSON round-trip for Patitas AST nodes. Converts typed AST nodes to/from JSON-compatible dicts.

stringbuilder

StringBuilder for O(n) string accumulation.

tokens

Token and TokenType definitions for the Patitas lexer. The lexer produces a stream of Token objects that the parser...

visitor

AST Visitor and Transformer for Patitas. Provides a base visitor class with match-based dispatch and an...