Also available in Korean: Ribbonpage를 만든 12일, 본문 추출에서 기기 내 번역까지

I wanted to read every web article I came across on my iPhone. If I shared a page from Safari on my Mac, I wanted the text and images waiting on my phone without depending on a third-party server. I handled product, design, and engineering myself. The result is Ribbonpage: each saved article is stored as a Markdown file alongside a local images folder, synced over iCloud between iPhone and Mac.

This is a chronological log of twelve days of building and using it, from November 18 to November 30 (555 commits including merges), ending with extracting the core engines into three public Swift packages (OozooHTML, OozooMarkdown, and OozooReader).

Two Renames and App Review

When I started on November 18, the app was called Pressleaf. Pulling a Substack post through Mozilla Readability dropped every subheading in the article. Inspecting the DOM showed that anchor links attached to headings caused Readability to strip the headings along with the links. Removing heading-adjacent anchor links before running extraction kept the headings intact.

Images were downloaded into the document’s folder and their Markdown paths rewritten to local files. When an image download failed, I left the original URL in place so it could be retried later.

On November 19, I renamed the app twice in one day. Pressleaf was already taken, so I switched to Webmarks, then found that taken as well. By the end of the day, the app name and bundle identifiers were all Ribbonpage.

On November 20, I submitted iOS and macOS 1.0.0(35) for review. Saved articles move as document folders into the library and get indexed in SwiftData. When moving a local library to iCloud, the app calls FileManager.setUbiquitous per document folder.

Starting with WKWebView and JS Bridge Overhead

The first reader used WKWebView. One HTML and CSS pipeline covered Markdown, tables, code blocks, and PDF print styling across both iPhone and Mac. To make saved web content safe to open offline, I used a non-persistent websiteDataStore, set allowsContentJavaScript = false, applied a strict default-src 'none' CSP, and served local images only from the active document folder through a custom WKURLSchemeHandler.

Adding reader features meant routing more state through JavaScript. Scroll-position persistence, footnote jumps, quote copying, and speech synthesis (AVSpeechSynthesizer) all had to cross WKUserScript, evaluateJavaScript, and WKScriptMessageHandler. Loading HTML strings with baseURL: nil turned the document URL into about:blank, forcing WKNavigationDelegate to separate external link blocking from about:blank# footnote navigation. Quote copying had to populate both Markdown and plain-text pasteboard slots or standard notes apps would not paste anything useful. Speech synthesis required a separate DOM script to collect paragraphs while skipping code blocks, tables, and footnotes, then highlight and center the active paragraph.

Right after launch, across v1.0.1(36) on November 21 and v1.0.2(37) on November 23, web-view-specific issues showed up in daily use. Reading and writing scroll-position files on the main thread caused brief stalls in iCloud libraries. Moving that file I/O to a background queue and ignoring late restore values if the user had already started scrolling stopped the view from snapping back. On iPhone, returning from the background occasionally triggered webViewWebContentProcessDidTerminate, leaving a blank white page. Handling that callback to stop speech and reload once the app became active patched it.

Each new feature added more code to the JS bridge, and opening another article still required loading a full HTML document. On November 24, I benchmarked nine library documents (excluding images) on Mac:

  • Fresh WKWebView: 79–247 ms
  • Reused WKWebView: 31–76 ms
  • TextKit prototype: 2–63 ms

That day I decided to build a native TextKit 2 reader and keep the HTML/CSS pipeline for PDF export.

Tables in TextKit 2 Rendered as File Icons

Later on November 24, I wired up tables via NSTextAttachmentViewProvider on the iOS Simulator. Instead of a table, iOS drew a generic file icon. On Mac, the table region was blank on first open. I wanted a single TextKit 2 text view so text selection stayed continuous across paragraphs. The workaround was to insert empty NSTextAttachment placeholders for tables and code blocks, then place the table views directly over the frames computed by NSTextLayoutManager. Cells appeared on both platforms.

That introduced a scroll conflict. On iPhone, horizontal table scrolling fought vertical article scrolling. I restricted horizontal drags on a table to cases where the table is wider than the viewport and abs(velocity.x) > abs(velocity.y). When a table scrolls off-screen, the reader stores its horizontal offset and detaches the view. The native reader became the default, with the web reader left as a fallback option in settings.

I grouped Markdown parsing and table-cell extraction into OozooMarkdown, and split out image, LaTeX, code syntax highlighting, and Mermaid (OozooMermaid) modules so the document model had zero dependency on UIKit or AppKit.

On November 26, I measured article open times on an iPhone 14 Pro running build 66 (17 documents in the library, 0 pending downloads): a 20,041-byte article opened in 181 ms, and a 15,849-byte article opened in 205 ms. I do not have a matched before-and-after measurement on the exact same document.

Moving Web Extraction from JS to Pure Swift

November 27 is the commit date for v1.1.0(68). Earlier, I had written down a rule to only consider a custom extractor if three separate domains failed in the same way. I gave up before reaching that threshold for a simpler reason: every extraction tweak meant keeping a JS bundle and Swift tests in sync. I left WKWebView with one job, loading the page and taking a DOM snapshot, and moved HTML5 parsing, Readability, and Markdown conversion into a pure Swift module, OozooHTML.

Two sites failed right away. MDN code examples sit inside open shadow roots, so outerHTML dropped all the code. During snapshotting, I walked open shadow roots and inlined their HTML in order. Mobile Wikipedia wraps article sections in nested collapsible containers, so the extractor had to unwrap from the inside out and strip heading edit links.

On November 28, ahead of dev build 1.2.0(78), I ran 54 URLs through both the JS and Swift extractors and diffed the final output. A Naver Blog link produced identical output on Mac. That looked like a match until I checked the output and saw both extractors had failed to find the article body. To measure extraction quality directly, I ran both implementations against a corpus of 95 saved HTML files.

Three On-Device Translation Bugs in a Row

The same day, I started integrating Apple’s on-device TranslationSession. Rather than sending raw Markdown, the reader splits parsed paragraphs and table cells into translation units. On OS 26.0–26.3, batch translation accepts plain text only; starting in 26.4, it accepts formatted AttributedString. Three bugs came up during testing:

  1. Batch calls dropped formatting. On macOS 27.2.1, batch-translating paragraphs containing links or emphasis returned translated text with attributedTargetText set to nil. Calling translate(_:) on one unit at a time preserved the attributes. I switched formatted units to per-unit calls and fell back to plain text only when the attributed response could not be used.
  2. Scroll position jumped ~400 pt. On the final day, toggling translation far down a long article on iPhone shifted the reading line by roughly 400 pt. TextKit logs showed the target line at the expected Y coordinate, while UIKit rendered a different sentence on screen. Swapping attributedText mid-document caused the desync. Recording the active paragraph anchor, jumping to the top to replace the text, and then scrolling back to the anchor fixed it.
  3. First-tap false unsupported. For a language pair already downloaded on the device, the first tap after launching the app reported that translation was unsupported, while a second tap immediately worked. LanguageAvailability was returning unsupported on the first lookup. I changed the flow to call prepareTranslation() on the session whenever uncached units exist, and to surface the unsupported alert only if the session itself throws that error.

On an iPhone 14 Pro running iOS 27.2.1 (build 82), I re-opened the same Chinese X post that had been failing. All 168 units translated on the first tap, and toggling translation off and on kept the same paragraph and image anchored in place.

One Space Left Asterisks in Exported PDFs

Build 84 added the article title to translation, but exporting still output the original text only. Build 85 split the share menu into Original and Translated while leaving the source file in the library untouched.

To reassemble translated Markdown without corrupting code blocks or table syntax, the exporter reads the original Markdown as a byte array and replaces translated inline spans from back to front so earlier byte offsets never shift.

Opening a translated PDF showed literal asterisks around bold text. Translation had produced **혜택을 ** with a trailing space right before the closing delimiter, which prevented the Markdown parser from closing the emphasis span. In build 86, I moved leading and trailing whitespace outside the delimiters, and fell back to HTML tags when the trimmed boundary landed next to punctuation or symbols. The regression test checks this string:

사실 **숨겨진 혜택을** 놓쳤고 <strong>(두 번) 냈습니다</strong>.

and verifies that re-parsing produces two emphasis spans.

Extracting the Engines into Three Public Swift Packages

As the final step on November 30, I extracted the four internal engines (OozooMarkdown, OozooHTML, OozooWebReader, and OozooNativeReader) into three public SwiftPM repositories:

  • OozooHTML: Zero-dependency pure Swift HTML5 parser, Readability extractor, and Turndown/GFM Markdown converter. Targets iOS 16 / macOS 13 (40 tests).
  • OozooMarkdown: Five products (OozooMarkdown, OozooMarkdownImage, OozooLaTeX, OozooCodeSyntax, OozooMermaid) with no UIKit/AppKit dependency in the core model. Targets iOS 16 / macOS 13 (115 tests).
  • OozooReader: Bundles OozooWebReader and OozooNativeReader. Package manifest targets iOS 26 / macOS 26 (10 tests: 4 web, 6 native).

Extracting OozooHTML and OozooMarkdown was quick because UIKit and AppKit had already been kept out, so both target iOS 16 / macOS 13. OozooHTML still had an app-specific math attribute (data-ribbonpage-notation); I changed the default to data-oozoo-math-notation and passed the old name as an option from Ribbonpage for compatibility.

Separating the readers took more work. From OozooWebReader, I pushed the custom image scheme, CSP, iCloud scroll-position files, and a reverse dependency where image copying called into the native renderer back out to the host app. With those removed, OozooWebReader itself compiles down to iOS 16 / macOS 13.

In OozooNativeReader, I kept only TextKit 2 layout, overlay positioning, and bitmap rendering for tables, math, and diagrams. Storage, themes, translation sessions, speech synthesis, and clipboard handling moved to the host. Because of existing SwiftUI font APIs, OozooNativeReader and the combined OozooReader manifest stay at iOS 26 / macOS 26. Both reader modules are read-only views, not text editors.

On the local branch before publishing, all standalone package tests passed (OozooMarkdown: 115, OozooHTML: 40, OozooWebReader: 4, OozooNativeReader: 6), along with 392 RibbonpageCore Release tests, iOS Simulator and macOS app builds, and 0 SwiftLint violations across 360 files. Runtime testing on the minimum supported OS versions (iOS 16 / macOS 13) and on-device UI verification after package extraction are still pending.

Version Log

Tag dates reflect commit timestamps; numbers in parentheses are build numbers.

DateMilestone
11/18Started iPhone and Mac app as Pressleaf
11/19Renamed to Webmarks, then Ribbonpage with updated identifiers
11/20Submitted iOS and macOS 1.0.0(35) for review
11/21Tagged v1.0.1(36)
11/23Tagged v1.0.2(37)
11/27Tagged v1.1.0(68)
11/28Dev build 1.2.0(78)
11/30Dev build 86 (12 days from first commit, 555 commits including merges)
11/30Extracted and verified 4 engines across 3 public SwiftPM repositories (OozooMarkdown, OozooHTML, OozooReader)

How to save links from Safari on iPhone and Mac