I finally wrote my favorite library.
Synhigh is small, fast, and needs no dependencies or build step. It detects languages automatically, includes line numbers and a copy button, and won’t clash with your site’s styles.
Demo: https://synhigh.github.io/synhigh-code-highlighter/
https://github.com/Synhigh/synhigh-code-highlighter
synhigh.github.ioCode Highlighter demo
commit b8dfd5b