Skip to content
wispsyPublic

About

Rich Text Format parser for Python

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

parse-rtf

parse-rtf is a bounded, source-aware Rich Text Format (RTF 1) parser for Python 3.14+. It has no runtime dependencies.

from parse_rtf import loads

document = loads(r"{\rtf1\ansi Hello, {\b world}!\par}")
print(document.text)  # Hello, world!\n

Document.source preserves the exact input. Document.root is an immutable syntax tree of groups, literal text, control words and symbols, hexadecimal bytes, and opaque binary data. Every node has a SourceSpan with source offsets and one-based line/column positions. Document.text provides a safe plain-text projection; non-text destinations and formatting controls remain available in the syntax tree. Non-fatal limitations are reported in Document.diagnostics.

The parser enforces configurable input-size, nesting, and node limits. See supported syntax and API and security boundaries.

Development

uv sync --locked
uv run --frozen python -W error::ResourceWarning -m pytest -q
uv run --frozen python scripts/check_distribution.py --output-dir dist

The distribution is named parse-rtf; the Python import package is parse_rtf.

See release instructions for trusted PyPI publishing setup.

About

Rich Text Format parser for Python

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages