Skip to content

feat(document): MINT document representation for parsed files - #2

Merged
hshekhar-git merged 3 commits into
mainfrom
feat/docling-mint-document
Jun 25, 2026
Merged

hshekhar-git merged 3 commits into
mainfrom
feat/docling-mint-document

Conversation

@hshekhar-git

Copy link
Copy Markdown
Member

Summary

  • Adds a first-class document representation to MINT so it can losslessly serialize a parsed document (the shape produced by parsers like Docling): title, metadata, §-level sections, prose, tables, lists, and figures with page references.
  • New exports encodeDocument / decodeDocument + types MintDocument, MintSection, MintDocBlock, MintDocTable, MintDocList, MintDocFigure (re-exported from the package entry).
  • Headings use § (not #, which is reserved for comments). The document grammar lives in dedicated functions, so general-purpose encode / decode are unaffected.
  • SPEC bumped to 1.1.0 with a new §15 "Documents"; package bumped to 1.1.0.

Why

Downstream (context-engine) needs to ingest customer files via Docling and inject their content into LLM prompts token-efficiently. MINT's object/table syntax can't express document hierarchy compactly, so this adds the missing representation.

Test plan

  • pnpm --filter @q1k-oss/mint-format test — 54 passing (8 new document round-trip/edge tests)
  • pnpm --filter @q1k-oss/mint-format typecheck
  • pnpm --filter @q1k-oss/mint-format build (dist regenerated)
  • validate(encodeDocument(doc)).valid === true and decodeDocument(encodeDocument(doc)) deep-equals the input
  • Note: repo-wide lint script is pre-existing-broken (eslint --ext + missing typescript-eslint); not touched here.

Adds encodeDocument/decodeDocument and the MintDocument/MintSection/
MintDocBlock types so MINT can losslessly represent a parsed document
(title, metadata, §-level sections, prose, tables, lists, figures with
page refs) — the structure produced by parsers like Docling. Headings
use § rather than # (reserved for comments), and the document grammar
lives in dedicated functions so general-purpose encode/decode is
unaffected. Bumps to 1.1.0; SPEC §15 documents the grammar.
@avnsh
avnsh force-pushed the feat/docling-mint-document branch from 96a5241 to 973cb11 Compare June 25, 2026 03:28
@hshekhar-git
hshekhar-git added this pull request to the merge queue Jun 25, 2026
Merged via the queue into main with commit 17e268e Jun 25, 2026
1 check passed
@hshekhar-git
hshekhar-git deleted the feat/docling-mint-document branch June 25, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants