Install
pip install rosettes
Requires Python 3.14 or later. See installation for alternative methods.
Highlight Code
from rosettes import highlight
html = highlight("def hello(): print('world')", "python")
print(html)
Output:
<div class="rosettes" data-language="python">
<pre><code><span class="syntax-keyword">def</span> ...
What's Next?
Quickstart
Start Here
Highlight code in 2 minutes
Complete walkthrough from install to styled output.
Parallel Processing
Process multiple blocks concurrently
For sites with many code blocks,highlight_many()provides 1.5-2x speedup.
Styling
CSS classes and themes
Use semantic classes or Pygments-compatible themes.
Quick Links
- API Reference — Complete function signatures
- Languages — All 55 supported languages
- vs Pygments — Feature and performance comparison