SwiftText
Latest: v2.10.0
Digitised books render as printed. render --footnote-labels source keeps the footnote numbers written in the Markdown ([^31] shows 31), --footnotes page now fills every page with a custom @page size or wide side margins, and ocr -m no longer reports scan shadows and show-through as images. docx -m writes Word tables as Markdown tables.
Render
--footnote-labels source(#270). A footnote whose id is a number, or ends in one after a separator ([^31],[^k2-48]), is labelled with that number instead of the running count. Other ids keep the running count; the default is unchanged.--footnotes pagerespects@pagesize and side margins (#269). A custom trim size (for example 170 × 240 mm) or wide margins no longer leave every other page nearly empty.- HTML renderer: inline-blocks are laid out, corners are rounded and bold is synthesised where a face is missing (#266).
OCR
ocr -m: no phantom![Image]()blocks over scan-edge shadows and grey show-through on scanned pages; real photos are kept (#268).
DOCX
docx -memits GFM pipe tables from native Word tables instead of bold paragraphs (#258).- Rendering to DOCX: links inside footnotes are clickable (#260); quotes and further paragraphs inside list items are kept (#261).
Project
- Releases update the Homebrew tap (#256) and publish the SwiftText agent skill to ClawHub (#257).
- CI: Windows zlib import lib name (#263); Android emulator cold boot and 25-minute cap (#265).
SwiftText
One CLI, swifttext, that reads documents into text, Markdown or tables, and
renders Markdown (or HTML) into finished documents. Everything runs locally; no
app needs to be open or installed.
What it reads and writes
| You have | You want | Command |
|---|---|---|
| PDF (text layer) | text | swifttext ocr file.pdf |
| PDF (text layer) | Markdown (lists/tables) | swifttext ocr file.pdf -m (macOS 26+) |
| Scanned PDF, photo, screenshot | text | swifttext ocr file.png [--language de] |
| Scanned PDF, photo, screenshot | Markdown (lists/tables) | swifttext ocr file.png -m [--language de] (macOS 26+) |
Word .docx | text or Markdown | swifttext docx file.docx [-m] |
Pages .pages | text or Markdown | swifttext pages file.pages [-m] |
Numbers .numbers | TSV, Markdown, HTML or JSON tables | swifttext numbers file.numbers [-m | --html | --json] |
Keynote .key | text, Markdown or JSON slides | swifttext keynote file.key [-m | --json] |
Web page or .html | text or Markdown | swifttext html <url-or-file> -m [--main-content] |
| Markdown | HTML, PDF, DOCX, Pages or EPUB | swifttext render file.md -o out.pdf (format from the extension) |
HTML, Markdown, .docx, .eml, URL | swifttext pdf <input> [-o out.pdf] | |
| PDF or image | a picture of what was detected | swifttext overlay file.pdf (macOS 26+) |
ocr is the default subcommand, so swifttext file.pdf also works.
Platforms
Recognising text in images and PDFs (ocr) and drawing what was detected
(overlay) use Apple's Vision framework. They are available only on Apple
platforms: in the CLI on macOS, and through the SwiftText library on iOS. The
CLI also builds for Linux and Windows. There ocr and overlay don't exist,
so a PDF or image can't be read and there is no default subcommand. pdf,
render and html --webkit can't use WebKit there either; pdf and render
always use the pure-Swift engine. Every other reader and writer works the same
on all platforms.
Vision document segmentation is macOS 26 only. That gates ocr -m /
--markdown, ocr --save-images, and the whole overlay subcommand. On
macOS 13–25 use plain ocr (no -m, no --save-images); structured Markdown,
saved page images, and overlay drawings are unavailable there.
Core rules
- Never open or script Pages, Numbers, Keynote or Word to read or produce a
document.
swifttextreads and writes these files directly. - Ask for Markdown (
-m/--markdown) whenever structure matters: headings, lists and tables survive; plain text flattens them. Exception: forocr, only pass-mon macOS 26+; on older macOS use plain OCR instead. - For data you will process further, prefer machine formats:
numbers --jsonor the default TSV,keynote --json. - Use
-o/--output-pathfor anything long instead of capturing stdout. rendertakes Markdown only. To turn HTML into a PDF useswifttext pdf.- Option names differ between subcommands (
-ois--output-pathfor readers and--outputforpdf/render). When unsure, checkswifttext help <subcommand>; it is always current for the installed version.
Common jobs
# Scanned German letter → text (works on every macOS that has ocr)
swifttext ocr scan.pdf --language de -o letter.txt
# Same scan → structured Markdown (macOS 26+ only)
swifttext ocr scan.pdf -m --language de -o letter.md
# PDF with a broken or garbage text layer → re-recognise every page
swifttext ocr report.pdf --force-ocr
# Spreadsheet → JSON for analysis
swifttext numbers budget.numbers --json -o budget.json
# Article → clean Markdown without navigation and cookie banners
swifttext html https://example.com/post -m --main-content -o post.md
# Markdown report → a Pages document someone can edit
swifttext render report.md -o report.pages
# Markdown → printable PDF with a title page and contents
swifttext render report.md -o report.pdf --title-page --toc --author "Name"
# Email → PDF for filing
swifttext pdf message.eml -o message.pdf
More
references/reading.md: each reader's options and what to expect from it.references/writing.md:renderandpdfin depth: books, EPUB, styling.
