Why
Reader mode is implemented as a sizable JavaScript extraction and rendering script embedded in Sources/Quartz/QuartzApp.swift. It works for many article pages, but changes are hard to review because there are no fixtures or repeatable extraction tests.
Where to start
Sources/Quartz/QuartzApp.swift
- The
enterReaderModeScript and exitReaderModeScript constants
- A new test fixture directory, if useful
Suggested approach
Make reader mode more testable without changing its user-facing behavior. Options include moving the JavaScript into a separate bundled resource, adding HTML fixtures, and adding tests that run the extraction logic against representative article pages.
Good fixtures would include:
- a simple article with headings and paragraphs
- an article with images and captions
- a page with nav/sidebar/comment content that should be removed
- a short page that should be rejected as too short
Acceptance criteria
- Reader mode JavaScript is easier to review than one large embedded Swift string, or it has fixture coverage that makes changes safer.
- Fixtures cover at least three page shapes.
- Tests or documented manual checks verify that article content is kept and obvious junk is removed.
- Existing reader mode behavior remains available from the toolbar and View menu.
swift build succeeds.
Testing
- Run any new reader-mode tests.
- Run
swift build.
- Manually open at least one article page and confirm Reading Mode still enters and exits correctly.
Why
Reader mode is implemented as a sizable JavaScript extraction and rendering script embedded in
Sources/Quartz/QuartzApp.swift. It works for many article pages, but changes are hard to review because there are no fixtures or repeatable extraction tests.Where to start
Sources/Quartz/QuartzApp.swiftenterReaderModeScriptandexitReaderModeScriptconstantsSuggested approach
Make reader mode more testable without changing its user-facing behavior. Options include moving the JavaScript into a separate bundled resource, adding HTML fixtures, and adding tests that run the extraction logic against representative article pages.
Good fixtures would include:
Acceptance criteria
swift buildsucceeds.Testing
swift build.