gitmyhub

lsdoc

Rust ★ 1 updated 6d ago

Rust reimplementation of Logseq's mldoc parser

A Rust parser that reads Logseq flavored Markdown and Org files and matches Logseq's own parser exactly, meant to replace inconsistent parsing code in a sibling note app.

RustNode.jsCargosetup: moderate

lsdoc is a parser, written in Rust, for the special flavor of Markdown and Org text format used by the note taking app Logseq. A parser reads raw text and turns it into a structured, computer readable version of that text, called an AST, which other software can then use to render the page or build search indexes. This project is meant to behave exactly like Logseq's own official parser, called mldoc, for the parts that matter for search and rendering, so it can act as a drop in replacement.

Its main intended use is inside a sibling project called Tine, a similar note taking app, which currently has two separate, inconsistent pieces of parsing code that this project is meant to replace with one shared, correct implementation.

To prove it matches the real Logseq parser, the project runs both parsers side by side on the same input text and compares their output, a technique called differential testing. According to the README, this comparison currently passes on nearly 1,200 test inputs across both Markdown and Org formats, with zero differences, plus additional tests focused on individual blocks and inline text. It has also been fuzz tested, meaning it was fed large amounts of random input, over 160,000 times without crashing.

Users who already use Logseq can check how lsdoc performs against their own notes: a small Node.js based tool clones the project, runs both parsers on the user's own Logseq folder, and writes a local comparison report, without uploading any of the user's notes anywhere. No Rust installation is needed for this check, since a ready built copy of lsdoc is downloaded automatically.

The project is licensed under AGPL-3.0 and is consumed as a Rust dependency by other Rust projects.

Where it fits