r/webdev • u/ExpertPlay • Oct 17 '26
Showoff Saturday I built a small library for highlighting text and adding notes on any webpage
I was reading brown's rust book and they have this cool feature that lets you highlight stuff and leave notes while reading. I wanted something similar on a site I'm building, but the libs I found were either too complex or too simple and still a pain to set up, so I made one. Heavily inspired by the simplicity and DX of sonner.
You only need annotate('#article') and that's basically it. It saves to localStorage or your own backend.
Cool thing is that it uses the css highlight api, so it doesn't touch your dom at all (which would be especially bad for frameworks like react, vue, etc). Downside is no support for older browsers.
About 15kb with UI or 6kb headless if you want to build your own UI, and it ships with a React adapter.
playground: https://penciled.org/playground/
repo: https://github.com/marcellosso/penciled
Still early, so any feedback is welcome
4
u/kcure Oct 17 '26
looks cool thanks for sharing
1
u/FPSectus Oct 19 '26
Great idea, it's going to make reading academic articles so much easier, you're my hero.
1
u/Disastrous_News_9798 Oct 18 '26
its nice
1
u/lepture full-stack Oct 18 '26
It looks clean and beauty. Thanks for sharing.
1
u/OkGoOn Oct 18 '26
as someone who highlights text when they read it, i loathe when sites add these features.
1
u/[deleted] Oct 18 '26
[removed] — view removed comment
1
u/[deleted] Oct 17 '26
[removed] — view removed comment