rtf-parser-tt
RTF parser with special character support. Fork of rtf-parser by @d0rianb.
Why This Fork?
The upstream rtf-parser crate silently drops special character control words like \emdash, \endash, and smart quotes. This causes data loss when parsing RTF from applications like Scrivener, Microsoft Word, and others.
This fork adds support for these characters.
Support
If you find this crate useful, consider supporting development:
Installation
[]
= "0.5"
What's Added
| Control Word | Unicode | Character |
|---|---|---|
\emdash |
U+2014 | — |
\endash |
U+2013 | – |
\bullet |
U+2022 | • |
\lquote |
U+2018 | ' |
\rquote |
U+2019 | ' |
\ldblquote |
U+201C | " |
\rdblquote |
U+201D | " |
\tab |
U+0009 | (tab) |
\line |
U+000A | (newline) |
Usage
use RtfDocument;
API
The API is identical to rtf-parser. See the original documentation for full details.
Key types:
RtfDocument- Parsed RTF documentLexer- Tokenizes RTF inputParser- Converts tokens to documentStyleBlock- Text with formatting infoPainter- Text style (bold, italic, etc.)Paragraph- Layout info (alignment, spacing)
Upstream Status
A PR has been submitted to the upstream rtf-parser repository. Once merged, this fork may be deprecated in favor of the upstream version.
License
MIT License - same as upstream.
Credits
- Original crate: rtf-parser by @d0rianb
- Fork maintained by TwelveTake Studios