Settings

Theme

Show HN: Pygments Swift – Swift-native syntax highlighting library

github.com

1 points by senthilnayagam 13 days ago · 0 comments · 1 min read

Reader

Pygments Swift, a Swift-native port of the Python Pygments syntax highlighting engine.

We built this while working on our own Mac/iOS app (QW Code Viewer) the core highlighting engine as a standalone library.

Key points:

Written entirely in Swift (no Python runtime or bindings

Currently supports ~20 programming file formats

Designed for Mac & iOS usage

Includes unit tests + visual regression tests

PNG and PDF outputs are verified using OCR(tesseract) to ensure the rendered syntax highlighting is actually correct (not just pixel-diffed)

The OCR testing was added because we wanted confidence that exported images/PDFs still preserve semantic correctness after rendering. Also because it was vibe coded.

This is our first OSS release in this space.

Happy to answer questions and learn from the community.

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection