@stnd/ingest
v0.1.0
Published
Document-to-Markdown converter for Standard Garden. Supports DOCX, PDF, HTML, and RTF.
Readme
title: "@stnd/ingest" aliases: [] created: 2026-07-05 07:40 modified: 2026-07-05 19:22 last_audited: 2026-07-14 audit_interval_days: 90 next_audit: 2026-10-12 audit_priority: 3 maturity: sprout mode: read publish: false status: active tags:
- package
- stnd theme: kernel type: package visibility: private
@stnd/ingest
Document-to-Markdown converter for the Standard Framework.
Converts DOCX, PDF, HTML, and RTF files into clean Markdown — ready for @stnd/press to render beautifully.
ELI5
Someone drops a Word doc, a PDF, or a random HTML export into your app — this turns it into plain Markdown so @stnd/press can typeset it properly. The heavy converters (mammoth for Word, pdfjs-dist for PDF) only load when that specific format is actually used.
Use it:
import { convertDocumentToMarkdown } from "@stnd/ingest";
const markdown = await convertDocumentToMarkdown(file);Philosophy
Strip everything that isn’t content. No formatting noise. The Press will apply beautiful typography automatically.
Supported Formats
| Format | Extensions | Engine |
| :-------------------- | :-------------- | :----------------------------------------------------------------------- |
| Plain text / Markdown | .txt, .md | Pass-through |
| Microsoft Word | .docx, .doc | mammoth (lazy-loaded) |
| HTML | .html, .htm | html-to-md |
| PDF | .pdf | pdfjs-dist (lazy-loaded) |
| Rich Text Format | .rtf | Basic text extraction |
Heavy dependencies (mammoth, pdfjs-dist) are lazy-loaded — they only get imported when you actually convert that format.
Usage
import {
convertDocumentToMarkdown,
extractDocumentTitle,
isSupportedDocument,
} from "@stnd/ingest";
// Check if a file can be converted
if (isSupportedDocument(file)) {
// Convert to clean markdown
const markdown = await convertDocumentToMarkdown(file);
// Extract a title from the resulting markdown
const title = extractDocumentTitle(markdown, file.name);
}API
convertDocumentToMarkdown(file): Promise<string>
Accepts a File object (or any object with name, type, text(), and arrayBuffer() methods). Returns clean Markdown.
extractDocumentTitle(markdown, filename?): string
Extracts a title from converted Markdown content. Checks headings first, then the first line, then falls back to the filename.
isSupportedDocument(file): boolean
Checks whether a file can be converted based on its MIME type or extension.
getSupportedMimeTypes(): string[]
Returns all MIME types that can be converted.
getSupportedExtensions(): string[]
Returns all file extensions that can be converted.
Relationship to other packages
User drops a file
↓
@stnd/ingest → "Here's clean Markdown"
↓
@stnd/press → "Here's beautiful HTML"@stnd/ingest handles the messy input. @stnd/press handles the beautiful output. Clean separation of concerns.
Notes / Observations
(jot down anything noticed here — quirks, gotchas, ideas)
Todo
- [ ] Maybe relocate to stnd.gd (app need > framework need). [priority:: 3] [token_scale:: 3] [created:: 2026-07-14] [area:: framework]
