A sample Safari Extension demonstrating how to implement a Reader Mode-like functionality using Safari App Extensions. This project shows how to extract and display article content in a clean, distraction-free popover view.
- Extracts article content from web pages and present it in a clean, readable format in a popover
- The extension adds a toolbar button to Safari
- When clicked, it injects JavaScript into the active webpage
- The JavaScript code:
- Looks for structured article data (JSON-LD)
- Falls back to searching for common article selectors
- Removes unwanted elements (ads, social media, etc.)
- Extracts text content from paragraphs and headings
- The extracted content is displayed in a popover
- macOS 12.0 or later
- Xcode 15.0 or later
- Clone the repository
- Open the project in Xcode
- Build and run the extension
- Enable the extension in Safari's preferences