get-md v1.6.0: PDF, DOCX, and Markdown ingestion alongside HTML #71
LottieOxford
announced in
Packages
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
get-md v1.6.0 is out. The library is no longer HTML-only: PDF, DOCX, and Markdown inputs join HTML and URLs, with auto-detection on the file extension or magic bytes. Behind that headline is a launch-hardening pass over the whole multi-format surface that closes a set of real bugs surfaced during review.
Built by the Nano Collective, a community collective building AI tooling not for profit, but for the community.
What changed
convertToMarkdownand the CLI now accept four input formats: HTML strings, URLs, PDF, DOCX, and Markdown files. Pass aBufferor aContentSourceand get-md routes it to the right extractor automatically. The CLI detects format from the file extension, and for stdin it inspects the%PDFmagic bytes directly.PDF ingestion
Pass a PDF
Buffer(auto-detected via the%PDFmagic bytes) or point the CLI at a.pdffile or URL. Text is reconstructed into real structure: wrapped lines reflow into paragraphs, ALL-CAPS lines become headings,•and numbered lines become lists with wrapped continuations folded in, and repeated running headers and footers are dropped.Title, author, and creation date are pulled from the PDF info dictionary into the frontmatter, alongside the computed
wordCountandreadingTime. The-- N of M --page markers thatpdf-parseemits by default are stripped before output. Readability is disabled for PDF input so body text is never dropped as boilerplate (a class of bug that was reachable in earlier code).Scanned or text-less PDFs return an empty result with a non-zero
inputLength, which is the signal that OCR is needed rather than a successful extraction. The extractor is powered bypdf-parse.DOCX ingestion
Pass a DOCX
Buffer(auto-detected via the ZIP/PKmagic bytes) or point the CLI at a.docxfile or URL. Two new exports are available for direct use:Supported structure: headings, bold/italic/underline/strikethrough, tables, and ordered/unordered lists. List type is resolved from
word/numbering.xml, not guessed fromnumIdparity, which previously caused ordered lists to flip to unordered at random. Nested tables no longer corrupt the outer table (the traversal now uses direct children). Decompression is capped at 100 MB, and corrupt, encrypted, ordocument.xml-less archives raise clear errors. The extractor is powered bynode-stream-zip.Markdown input
.mdand.markdownfiles (orinputType: "markdown", or aContentSourcewithtype: "markdown") skip HTML parsing entirely and run only the optimization passes: metadata, frontmatter, and structure normalization.Existing frontmatter is preserved: your
titleandauthorare kept, and only the computedwordCountandreadingTimeare appended. Earlier code could produce a doubled frontmatter block or clobber the real title when a.mdfile already had YAML at the top. That path is fixed. The--no-links,--no-images, and--no-tablesfilters are honored on Markdown input as well.Bug fixes from the launch review
The multi-format surface got a top-to-bottom pass before this release shipped. Highlights:
-- N of M --separators no longer leak into the output.word/numbering.xml, not from anumId-parity guess.convertToMarkdown. A DOCXBuffernow converts throughconvertToMarkdown(via PK/zip detection), matching the PDF buffer path instead of throwing..mdfile that already had frontmatter no longer produces a doubled block or clobbers the real title.--no-links,--no-images, and--no-tablesare honored for Markdown input.scripts/test.shand the badges workflow now build first, since the CLI end-to-end tests spawn the compiledbin/get-md.js(staledist/would skew results).CLI
The CLI advertises all four formats and detects the input type from the extension, or from the
%PDFmagic bytes on stdin:Documentation
The Conversion API page covers PDF and DOCX buffers, binary auto-detection,
inputType, theconvertDocx*exports, and Markdown input. The CLI reference documents format detection and the DOCX/.mdinput paths. Getting Started and Quick Start show PDF, DOCX, and Markdown examples alongside the HTML path.Tests
592 passing (up from 528 at 1.5.0). New coverage for PDF extraction, page-marker stripping, info-dict metadata, and structure reconstruction; DOCX buffer routing,
numbering.xmllist resolution, and corrupt-archive errors; Markdown-input frontmatter preservation and content filtering; and real DOCX and PDF CLI end-to-end runs.Upgrading
Or:
Node.js 22 or later is required. No peer dependencies are required for the standard HTML/PDF/DOCX/Markdown paths.
If you hit any issues or want to discuss the new format support, open an issue or find us on Discord.
Repo: https://github.com/Nano-Collective/get-md
Beta Was this translation helpful? Give feedback.
All reactions