Hasty Briefsbeta

Bilingual

Writing an Asciidoc Parser in Rust: Asciidocr

6 months ago
  • #Parser
  • #Rust
  • #Asciidoc
  • The author created an Asciidoc parser in Rust called 'asciidocr' to suit their needs, preferring Rust over Ruby (used in Asciidoctor) for its compiled nature and speed.
  • The parser follows a three-step process: scanning the document into tokens, parsing those tokens into a tree, and then converting the tree into useful outputs like HTML or DOCX.
  • Key features include handling Asciidoc's line-based syntax, extensive use of Rust enums and structs for tokens, and generating an Abstract Syntax Graph (ASG) for document representation.
  • The project includes a templating system using 'tera' for HTML output and aims to support DOCX generation for easier document sharing, especially useful for authors needing Word-compatible files.
  • Additional functionalities include Python bindings via 'pyo3' for easy integration into Python workflows and plans for future enhancements like PDF support and more comprehensive Asciidoc language coverage.