Add Image OCR converter, import docs, README/license updates, and expand CI/tests - #14
Conversation
… updates ### Motivation - Add on-device image OCR support and recognize image inputs in the native conversion pipeline so apps can import photos and perform OCR on Apple platforms. - Make reserved document-format implementation plans explicit and provide app integration guidance for import buttons, PhotosPicker, and Share Extensions. - Harden the CLI smoke tests and unit tests to cover empty inputs and routing for reserved/unsupported formats. ### Description - Add `ImageOCRConverter` with conditional `Vision`/`CoreGraphics`/`ImageIO` compilation that extracts text via Vision and returns a `MarkdownDocument`, and register it in `MarkItDown.defaultConverters`. - Extend `DocumentFormat` to include image formats (`png`, `jpeg`, `heic`, `tiff`, `gif`) and add `imageFormats` helper; update `JSONConverter` to surface targeted errors for empty or invalid JSON inputs. - Add comprehensive unit tests in `SwiftMarkItDownTests` covering format inference, fixture-backed conversions, JSON error cases, image OCR routing (conditional), and unsupported/reserved format errors, plus supporting fixture files and an empty expected file. - Improve `Scripts/smoke-test.sh` to include error-case checks, add many fixture files, add `Docs/ImportButtonIntegration.md` and `Docs/NativeConverterBackends.md` with integration guidance and backend plans, update `README.md`, add an `MIT` `LICENSE`, and bump GitHub Actions checkout to `actions/checkout@v5`. ### Testing - Ran the unit test suite with `swift test` which succeeded against the updated test cases. - Ran the CLI fixture smoke tests with `Scripts/smoke-test.sh` which completed successfully and validated both success and error-path smoke cases. - CI is configured to run the same checks on push and PRs via the updated `.github/workflows/ci.yml`.
…-ingestion-wzuajz
💡 Codex Reviewhttps://github.com/etherlink-intern/codexplayground/blob/e60e5ab0d90c6a30f12562b4584beea67df22afa/Sources/SwiftMarkItDown/Converters/ImageOCRConverter.swift#L27 For JPEG/HEIC/TIFF photos whose EXIF orientation is not https://github.com/etherlink-intern/codexplayground/blob/e60e5ab0d90c6a30f12562b4584beea67df22afa/Docs/ImportButtonIntegration.md#L375-L376 For share-extension attachments loaded with ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Motivation
fileImporter,PhotosPicker, Share Extensions) into the conversion core.Description
ImageOCRConverterthat uses Apple Vision (behind#if canImport(Vision) && canImport(CoreGraphics) && canImport(ImageIO)) to extract text lines from images and return aMarkdownDocument, and register it inMarkItDown.defaultConverters.DocumentFormatwith image formats (png,jpeg,heic,tiff,gif) and aimageFormatshelper set, and update inference from filename and content-type.JSONConverterto throw a targetedmalformedInputon empty or unparseable JSON inputs and improve error mapping.Docs/ImportButtonIntegration.mdandDocs/NativeConverterBackends.md, updateREADME.mdwith supported formats and planned backends, and add anLICENSE(MIT).actions/checkouttov5and runner tomacos-15in.github/workflows/ci.yml, enhanceScripts/smoke-test.shto cover empty/unsupported cases, add many fixture files and anempty.mdexpected output, and extend unit tests to cover image formats, fixture-backed conversions, and unsupported/reserved-format routing.Testing
swift test, which completed successfully.Scripts/smoke-test.sh, which completed successfully and verifies supported fixtures and expected error messages for unsupported/reserved formats.Codex Task