malachi-docsight

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT

README

docsight

Convert documents to Markdown for language models. A Go take on Microsoft's markitdown: one static binary, no Python, usable as a CLI, an MCP server, or a Go library.

Format What is kept
PDF text laid out as pdfminer.six (and so markitdown) does, one paragraph per text box, ruled tables (cells drawn with lines) as Markdown tables, with <!-- Page N --> markers, headings marked where the type is clearly larger than the body, ligatures spelled out, and words hyphenated at line ends rejoined; encrypted files that open without a password, damaged files, CJK fonts
Word (.docx) headings, bold/italic/strikethrough, links, lists, tables, images (alt text and file), equations as LaTeX, comments, footnotes and endnotes as Markdown footnotes, text boxes
PowerPoint (.pptx) slides in order, titles, text in reading order, tables, charts as data tables, image alt text, speaker notes
Word 97-2003 (.doc) headings, bold/italic, links, numbered and nested lists, tables, footnotes, endnotes and comments; text boxes; embedded documents and sheets converted in place
PowerPoint 97-2003 (.ppt) slides in order, titles, text in reading order, speaker notes; embedded documents and sheets converted in place
Excel (.xlsx, .xls) one table per sheet, shared strings, dates, percentages and currencies (on full-precision values), booleans, formulas' values
Outlook (.msg) sender, recipients, date, subject, body (plain, or HTML as Markdown), attachments converted in turn
EPUB metadata, then chapters in spine order
HTML via html-to-markdown, with tables, charset detection, and embedded images elided; MediaWiki articles, YouTube watch pages and Bing results reduced to their content
RSS / Atom feed title, then each entry's title, link, date, author and content
Jupyter (.ipynb) markdown cells, code in the notebook's language, text outputs and errors
ZIP each file converted under its path, nested archives too, within size limits
Images size, and title, description, keywords, author, date, camera and GPS from EXIF, XMP and PNG text
Audio / video tags (title, artist, album…), duration, channels, sample rate, video size: MP3, M4A/MP4/MOV, WAV, FLAC
CSV / TSV a table
JSON, XML, Markdown, text passed through, decoded from legacy charsets (Shift-JIS, GBK, Windows-1252…) when not UTF-8

markitdown's own test files and must/must-not vectors (convert/testdata/markitdown) are part of the test suite, and every one passes. Left out are the vectors for markitdown's borderless form-table heuristic, which on real documents mostly made tables of prose (see convert/testdata/markitdown/SOURCE).

Use

go tool task build          # bin/docsight
docsight report.docx        # print Markdown
curl -s URL | docsight -    # read stdin
docsight mcp                # MCP server over stdio
docsight mcp -allow-fetch   # ...that may also fetch http(s) URLs
docsight -password PW f.pdf # an encrypted PDF that needs a password

The MCP server has one tool, convert_to_markdown, with the same name and uri argument as markitdown-mcp. It takes a path or a file:, data: or http(s): URI, plus optional offset/limit to page through long documents (2000 lines or 50KB per call by default). The same document is converted only once while you page through it.

An encrypted PDF that needs a password (most open without one) reports so, and the model is told to ask you for it and call again with password. The password passes through the model and its session, so treat it as shared; after three wrong ones for a document, docsight stops trying, so a model cannot guess its way in.

Not yet

Borderless tables in PDFs (markitdown guesses these from word positions), OCR of scanned pages, image captions and speech transcription (which need a model or a cloud service: in a harness, the agent's own model can look at an image), password-protected Office 97-2003 files, and Word 6/95 and PowerPoint 95 and earlier.

License

MIT; see LICENSE. docsight includes code ported from pdfminer.six and pdfplumber, test files from MarkItDown, and Adobe font data, under their own MIT and BSD licenses: see NOTICE.

Directories

Path Synopsis
cmd
docsight command
Command docsight converts documents to Markdown, on the command line or as an MCP server over stdio.
Command docsight converts documents to Markdown, on the command line or as an MCP server over stdio.
Package convert turns documents into Markdown for language models.
Package convert turns documents into Markdown for language models.
internal
cfb
Package cfb reads Microsoft Compound File Binary files ([MS-CFB]), the "OLE2" container of legacy Office formats: .xls, .doc, .ppt and Outlook .msg.
Package cfb reads Microsoft Compound File Binary files ([MS-CFB]), the "OLE2" container of legacy Office formats: .xls, .doc, .ppt and Outlook .msg.
cmd/pdfdump command
Command pdfdump prints a PDF's internals with docsight's parser, for debugging extraction:
Command pdfdump prints a PDF's internals with docsight's parser, for debugging extraction:
pdf
Package pdf reads the object structure of PDF files: objects, cross reference tables and streams, object streams, stream filters, encryption, and the page tree.
Package pdf reads the object structure of PDF files: objects, cross reference tables and streams, object streams, stream filters, encryption, and the page tree.
extract
Package extract runs a page's content streams and collects every character drawn, positioned and sized, as layout input.
Package extract runs a page's content streams and collects every character drawn, positioned and sized, as layout input.
font
Package font maps the bytes a PDF shows to text and glyph geometry: it decodes character codes, maps them to Unicode (ToUnicode CMaps, simple encodings with Differences, embedded font tables), and supplies widths, descent and vertical displacement.
Package font maps the bytes a PDF shows to text and glyph geometry: it decodes character codes, maps them to Unicode (ToUnicode CMaps, simple encodings with Differences, embedded font tables), and supplies widths, descent and vertical displacement.
layout
Package layout groups positioned characters into words, lines and text boxes, and orders the boxes for reading.
Package layout groups positioned characters into words, lines and text boxes, and orders the boxes for reading.
table
Package table finds ruled tables on a PDF page: tables whose cells are drawn with lines or rectangles.
Package table finds ruled tables on a PDF page: tables whose cells are drawn with lines or rectangles.
Package server serves document conversion as an MCP tool.
Package server serves document conversion as an MCP tool.
Package source opens the documents docsight converts: local paths, file: and data: URIs, and, when allowed, http(s) URLs.
Package source opens the documents docsight converts: local paths, file: and data: URIs, and, when allowed, http(s) URLs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL