Skip to content

Add image OCR converter, document format updates, docs, and license - #10

Merged
etherlink-intern merged 2 commits into
mainfrom
codex/identify-acceptable-document-types-for-ingestion-lgkwlo
Jun 2, 2026
Merged

Add image OCR converter, document format updates, docs, and license#10
etherlink-intern merged 2 commits into
mainfrom
codex/identify-acceptable-document-types-for-ingestion-lgkwlo

Conversation

@etherlink-intern

Copy link
Copy Markdown
Owner

Motivation

  • Add on-device image OCR support and make image inputs first-class in the conversion pipeline so apps can import photos and scanned images into Markdown.
  • Document how to wire system import surfaces (file importer, PhotosPicker, Share Extension) into the library and record a plan for future native/FOSS backends (PDF/DOCX/PPTX/XLSX).

Description

  • Introduce ImageOCRConverter that uses Apple Vision/CoreGraphics/ImageIO (guarded by #if canImport(...)) to extract recognized text lines and return a MarkdownDocument with OCR metadata.
  • Extend DocumentFormat with image formats (png, jpeg, heic, tiff, gif) and add imageFormats helper; update format inference to recognize image extensions and MIME types.
  • Include ImageOCRConverter in MarkItDown.defaultConverters so image inputs are routed to the OCR converter when available and otherwise result in unsupportedFormat when Vision is unavailable.
  • Add comprehensive documentation Docs/ImportButtonIntegration.md for importing via document picker, PhotosPicker, and Share Extensions plus Docs/NativeConverterBackends.md which outlines the planned native/FOSS backends and integration policy.
  • Update README.md to list supported input families and planned backends and add a project LICENSE (MIT).
  • Add new/updated tests in Tests/SwiftMarkItDownTests that verify image format inference and conditional Vision OCR behavior, plus helper code to render OCR test images when platform frameworks are available.

Testing

  • Ran the unit test suite with swift test on a macOS environment with Vision/CoreGraphics available, and the test suite (including the Vision OCR tests) passed.
  • Verified conditional behavior on platforms without Vision by ensuring the image conversion path throws ConversionError.unsupportedFormat in unit tests, which passed under those configurations.
  • Ran the CLI smoke tests via Scripts/smoke-test.sh and confirmed they completed successfully against the updated README and fixtures.

Codex Task

@etherlink-intern
etherlink-intern marked this pull request as ready for review June 2, 2026 11:13
@etherlink-intern
etherlink-intern merged commit 63f1bd3 into main Jun 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant