3 releases
new 0.1.3 | Dec 3, 2024 |
---|---|
0.1.2 | Nov 23, 2024 |
0.1.1 | Nov 23, 2024 |
#428 in Parser implementations
265 downloads per month
255KB
6K
SLoC
asciidocr
A(n in-progress, incomplete, but more or less functional) Rust library for processing Asciidoc files.
Installation
Right now the crate provides an asciidocr
executable as well as an
asciidocr-tck-adapter
executable. The latter is for future checking against
the still-in-progress asciidoc official spec. To install from crates.io
:
$ cargo install asciidocr
To install from source, clone and cd
into the repo and run:
$ cargo install --path .
== Usage (Command-Line)
Here's the usage:
$ asciidocr --help
A Rust CLI and library for processing Asciidoc files.
Usage: asciidocr [OPTIONS] <FILE>
Arguments:
<FILE>
Asciidoc file for processing. To read from standard input (stdin), use "-"
Options:
-o, --out-file <OUTPUT>
Optionally provide a filename for the output. To send to standard out (stdout), use "-"
-b, --backend <BACKEND>
Optionally select a backend for conversion
[default: htmlbook]
Possible values:
- htmlbook: Produces "Htmlbook-like" HTML documents
- docx: !Experimental! Produces a "manuscript-styled" DOCX document
- json: Produces the Abstract Syntax Tree generated by the parser as json
-h, --help
Print help (see a summary with '-h')
Features and Limitations
asciidocr
currently produces "Htmlbook"-style HTML for all handled
blocks/inlines and has limited, experimental support for producing docx
files,
namely prose files without tables, lists, etc., etc. Fair warning: content may
be dropped while creating docx
files until that feature stabilizes a little
more. It should, however, be good to go for your next great short story.
asciidocr
(more or less) parses the vast majority of "common" asciidoc markup
features. Some things it does not do (yet):
- "Literal" blocks (
...
) and inlines (+
delimited text) - Checklists
- Offsets
- Tagged regions/tagged includes
- Conditionals
- Complex table markup
- Complex nested lists
For a more complete list of the current limitations and caveats, see
LIMITATIONS.adoc
.
Project Goals
A non-exhaustive list:
- Coverage of the majority, if not all, asciidoc language features
- Passes the language compatibility toolkit tests
- Clean, simple HTML output as a default with extant but minimal styling
- Native "document" (
docx
orodt
, probablydocx
) output in a "manuscript" template, like what you might send to a publisher or literary journal - PyO3 hooks/project for use inside Python contexts
Similar Projects
Great minds think alike, and as such, a few other people are working on asciidoc tools in Rust now, too. Here are at least a few I know about:
Known Bugs
Things that should work, but are currently acting up:
- Definition list term ordering under certain circumstances.
If you discover other bugs, please open an issue.
Dependencies
~11–23MB
~276K SLoC