Repository navigation
feat(markkit): bytes-in document API with DOCX and spreadsheet conversion - #9
Merged
Merged
Conversation
…sion
- Markkit::extract_document / extract_document_sync taking DocumentHint
{ content_type, file_name } and returning Extraction { markdown, title,
format, warnings, stats }; extract_bytes delegates to it.
- Format::detect (content type -> extension -> magic bytes), Format::sniff,
Format::from_file_name; new Doc/Xls/Ods/Pptx variants, Format is
non_exhaustive and serde-serializable.
- DOCX via zip + quick-xml (docx-rs dropped): headings, emphasis, links,
numbering-based lists, tables, line breaks, core.xml title.
- XLSX/XLS/ODS via calamine 0.36: one section + GFM table per sheet,
row/column caps with truncated_sheet warnings, hidden sheets skipped.
- Safety: bounded ZIP decompression (entry count, per-entry and total
size), XLS/ODS grid pre-scan against dense-range amplification,
streaming XLSX cells, XML depth cap, no entity expansion, catch_unwind.
- PDF now returns UnsupportedFormat instead of an empty string.
- docx/spreadsheet build without reqwest; HTML tests/examples gated on
the html feature. CLI --file uses format detection.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2vd61x8kbPtmDxze9Q4Gi
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2vd61x8kbPtmDxze9Q4Gi
… client Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2vd61x8kbPtmDxze9Q4Gi
Remove unused pdf-extract (pdf feature is a placeholder), clearing lopdf RUSTSEC-2026-0187 and unmaintained ttf-parser. Upgrade pyo3 and pyo3-async-runtimes to 0.29 (RUSTSEC-2026-0176/0177) and bench tabled to 0.22 (drops unmaintained proc-macro-error2). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2vd61x8kbPtmDxze9Q4Gi
chaliy
force-pushed
the
claude/project-thread-gtqhrp
branch
from
October 12, 2026 18:29
6ecdf1d to
51192e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: markkit had no way to convert document bytes to Markdown. DOCX went through docx-rs with no limits, and the only office path pulled in the HTTP client stack.
cargo denyalso failed on newly published advisories.After:
Markkit::extract_document(bytes, DocumentHint)andextract_document_syncconvert DOCX, XLSX/XLSM, XLS and ODS to Markdown. They return anExtractionwith the title, the detectedFormat, warnings and stats.docxandspreadsheetfeatures build without reqwest or hyper, so fetchkit can embed markkit as its Office backend.cargo deny checkandcargo auditpass.How:
Format detection.
Format::detect,sniffandfrom_file_nameuse the content type first, then the file extension, then magic bytes. Detection works with no format feature enabled.DOCX. Read directly with
zipandquick-xml; docx-rs is removed. Every part is decompressed with caps and parsed into a depth-limited XML tree.Spreadsheets. Converted with calamine 0.36.
max_spreadsheet_cells, so a tiny file cannot force a huge dense-grid allocation.New
MarkkitBuilderlimits.max_archive_entries,max_archive_entry_size,max_archive_total_size,max_sheet_rows,max_sheet_cols,max_spreadsheet_cellsandinclude_hidden_sheets.Unsupported formats. PDF, PPTX, legacy
.docand XLSB are detected and return an explicitUnsupportedFormaterror.Advisories.
pdf-extract, which was never called. This clears lopdf RUSTSEC-2026-0187 and the unmaintainedttf-parser. Thepdffeature is now a dependency-free placeholder.pyo3andpyo3-async-runtimesto 0.29 (RUSTSEC-2026-0176/0177).tabledin the bench crate to 0.22, which drops the unmaintainedproc-macro-error2.Security tests. They cover:
Fixtures are built in memory.
CI. A new step tests
--no-default-features --features docx,spreadsheetand fails if an HTTP client appears in the dependency tree.Docs. Specs, the threat model (T6, S8–S11), the README and the CHANGELOG are updated.
Tests:
cargo test --workspacepasses.cargo clippy -D warningspasses for both the default and the all-features builds.cargo deny checkandcargo auditpass.Part of the fetchkit document conversion work (everruns/fetchkit#182). markkit will replace fetchkit's in-crate Office converter.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y2vd61x8kbPtmDxze9Q4Gi