Josep Bigorra created OrgWebAlchemy, a Guile Scheme library that parses Org-mode documents with Parsing Expression Grammars (PEG, via ice-9 peg) into an AST and renders them to HTML using SXML. Motivated by the fragility of ad-hoc regex approaches, the project expresses grammar rules as S-expressions (or traditional PEG syntax) so the grammar itself reads like language documentation. The pipeline is Org -> PEG -> AST -> SXML -> HTML, and supports headings, paragraphs, unordered/ordered/description lists, inline markup (italic, bold, code), links (with descriptions), tables, separators, source/example/quote blocks, and raw HTML export blocks that bypass inline parsing. Code and tests are on Codeberg; the author notes AI-assisted debugging but emphasizes handcrafted implementation and unit tests.
Concrete design choices include producing a flat sequence of list items from the PEG and then transforming indentation into a nested list tree during AST processing, which yields proper nested HTML lists; one remaining bug concerns mixing different list types. Representing HTML as SXML keeps rendering flexible and customizable via Guile parameters (including per-heading class functions). The project is LGPLv3-licensed, has a test suite, aims for Guix packaging, and invites feedback on grammar, AST design, parser architecture and missing Org constructs.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.