Advanced Modules
These modules provide advanced functionality for working with document ASTs, search indexing, document comparison, and LLM integration.
AST (Abstract Syntax Tree)
The AST module defines the document structure used internally by all2md. All parsers produce AST documents, and all renderers consume them.
For user-facing AST documentation, see Working with the AST.
Core Classes
Root document node containing all other nodes. |
|
Base class for all AST nodes. |
|
Helper for building complete documents. |
|
Abstract base class for AST node visitors. |
Key Node Types
Block-level nodes:
Heading node (h1-h6). |
|
Paragraph node containing inline content. |
|
Table node with optional header and alignment. |
|
Code block node with optional language specification. |
|
List node (ordered or unordered). |
|
Block quote node containing other block elements. |
Inline nodes:
Plain text node. |
|
Link node. |
|
Image node. |
|
Inline code node. |
|
Emphasis (italic) node. |
|
Strong (bold) node. |
AST Utilities
JSON serialization and deserialization for AST nodes. |
|
Core section utilities for document AST structures. |
|
Document splitting strategies. |
|
AST transformation and manipulation utilities. |
|
Utility functions for working with AST nodes. |
Search Module
Full-text and semantic search over converted documents:
High-level orchestration for indexing and querying documents. |
|
Index abstractions and manifest utilities for search backends. |
|
Chunk generation utilities for document indexing. |
|
Shared data structures for the search subsystem. |
Search Backends
BM25 keyword search index backed by rank-bm25. |
|
Vector search index built on FAISS and sentence-transformers. |
|
Utilities for combining multiple search backends. |
Diff Module
Document comparison and diff rendering:
Simple text-based document comparison using difflib. |
|
|
Diff renderers for various output formats. |
Quality Scoring
Three reads on conversion quality, answering three different questions.
all2md.confidence answers “can I trust this conversion?” It is
reference-free, scoring from the sanity signals the parser observed, which is
the only option for a document with no ground truth (a scanned PDF).
all2md.roundtrip answers “what did this conversion lose?” It manufactures
a reference by converting a document to another format and parsing it straight
back, then scores the structure that survived.
all2md.optimize answers “which of these settings is best?” — a distinct
question, and it needs a distinct objective. The confidence score cannot be used to
search: it saturates at 100 on anything not visibly broken, so across a sweep of
converter options it is flat and there is no gradient to climb. The round-trip score
cannot be used either, because re-parsing rendered output measures the renderer —
a garbled table round-trips through Markdown perfectly. So the optimizer scores the
parsed AST directly, on how much well-formed structure each setting recovers.
|
Conversion confidence reporting — a structured "quality card". |
|
Round-trip fidelity scoring — how much structure survives a conversion. |
|
Auto-tune converter options against a reference-free fidelity objective. |
MCP Server
Model Context Protocol server for LLM integration:
FastMCP server for all2md document conversion. |
|
Configuration management for MCP server. |
|
Tool implementations for MCP server. |
|
Document manipulation tool implementation for MCP server. |
|
Tool input/output schemas for MCP server. |
|
Security utilities for MCP server path validation. |
For user-facing MCP documentation, see MCP Server.
Packagers
Submission package generators for academic publishing:
ArXiv submission package generator. |