Development
How to build, check and measure the parser from a clone of this repository. What the packages export is in api.md.
Checks
Section titled “Checks”npm install, then npm run build:compile (type check), npm run lint, npm run format:check, npm run spellcheck, npm run lint:md and npm test. CI runs the same steps on every push and pull request.
Building the packages
Section titled “Building the packages”npm run build compiles both packages: @mnaoumov/obsidian-markdown-parser into dist/lib/, with an entry point per part (./editor, ./lezer, ./mdast, ./markdown-it, ./syntax, ./remark, ./metadata), and @mnaoumov/obsidian-markdown-parser-metadata (packages/metadata/), the metadata projection and its remark engine without the editor or CodeMirror dependencies. npm pack and npm pack --workspace packages/metadata make the tarballs.
Releasing
Section titled “Releasing”npm run version -- <major|minor|patch|x.y.z> bumps both packages to one version, settles CHANGELOG.md, commits, tags, pushes and creates the GitHub release. Publishing that release runs .github/workflows/publish-npm.yml, which builds and publishes both packages through npm trusted publishing.
Measuring
Section titled “Measuring”npx jiti scripts/demo/cm6-bench.tsmeasures the CodeMirror 6 host (cm6-host.md).npx jiti scripts/demo/build-demo-plugin.tsbuilds the demo plugin intodist/demo-plugin/; copy that folder into a test vault’s.obsidian/plugins/markdown-parser-demo/.npx jiti scripts/demo/demo-plugin-measure.tsruns it on a real vault in an Obsidian instance it starts, and prints its reports (demo-plugin.md). The demo plugin is never published.
Oracles
Section titled “Oracles”Every claim about Obsidian is checked against readings of a running Obsidian, stored in oracle/ (oracles.md).
npx jiti scripts/capture/oracle.ts --seed <n>reads a new editor-class oracle from a live Obsidian. It needs a globalobsidian-integration-testinginstall.npx jiti scripts/oracles/oracle-diff.ts [--oracle <file>]scores the tokenizer against an oracle;--show <id>...shows where documents differ.npx jiti scripts/oracles/syntax-diff.tsscores the Lezer tree against the oracles;--construct <name> --examples <n>shows where documents differ (syntax.md).npx jiti scripts/oracles/adapter-diff.ts [--adapter markdown-it]compares the mdast or markdown-it adapter with the Lezer tree, with the same options.npx jiti scripts/capture/worker-oracle.tsre-reads the worker oracle by running the metadata worker of anobsidian-versionscheckout beside this repository (metadata.md).npm run oracle:refresh -- [--obsidian-version <x.y.z|public-latest|catalyst-latest>]re-reads every oracle from another Obsidian, writes them beside the pinned ones, and reports per oracle the readings that changed and whether the parser matches them.npm run oracle:drift -- --to-version <version>gives the same report for oracles already read.
Desktop oracles are pinned to Obsidian 1.15.1; the Android oracles are measured independently and remain on 1.14.4.
Phase 0
Section titled “Phase 0”The harness in phase0/ stays only to reproduce phase-0.md: node phase0/oracle.mjs 300, then node phase0/gap.mjs 6 tree|lines|state.