Repository navigation
feat: pluggable FormatParser registry - #45
Merged
Merged
Conversation
- registry::FormatParser (name, formats, claims, parse) and MarkkitBuilder::parser; consulted before built-ins - custom parser output goes through transforms and the renderer; panics map to new Error::Parser - ParsedDocument::new is public
chaliy
force-pushed
the
claude/project-thread-2rc0mr
branch
from
October 27, 2026 03:30
6b60ec1 to
1963ef8
Compare
2 tasks done
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.
Requested by Михайло · project thread
What changed
Last extensibility step: embedders can add formats or replace a built-in parser without forking.
registry::FormatParsertrait:name,formats() -> &[Format], optionalclaims(bytes, hint),parse(bytes, &MarkkitBuilder) -> Result<ParsedDocument>. Register withMarkkitBuilder::parser(p).parse_document/extract_document, after themax_input_sizecheck: first parser whoseclaimsis true (formats with noFormatvariant), else first parser listing the detected format (fill PPTX, or replace HTML/CSV/...), else the built-in.max_output_sizeand title/metadata handling.Error::Parser; the deadline is checked when it returns.ParsedDocument::newis public so parsers can build results.Why
Roadmap "Extensibility": formats markkit doesn't ship (PPTX, internal formats) or site-specific replacements needed a fork.
Before / After
Before: no hook;
deck.pptxisError::UnsupportedFormat, and built-in parsers can't be swapped.After (
tests/registry.rs): a parser claiming a magic prefix handles a format with noFormatvariant; a parser listingFormat::Htmlreplaces the built-in:Without registered parsers: behavior unchanged (
unregistered_format_still_unsupported,builtin_runs_when_nothing_claims).Risk
Error::Parservariant (Erroris already#[non_exhaustive]).Checklist
formats/format-support.md,foundations/architecture.md,security/threat-model.md, log), CHANGELOG