Why share code as an image
On social networks and in slides, text code loses its indentation and colours. An image keeps the layout exactly as written and draws the eye. For anything people need to copy, pair it with a share link or the code as text.
Syntax highlighting, done right
Each language is highlighted with its own grammar: keywords, strings, numbers, comments, functions and types get distinct colours from the theme. Auto-detection works well on a few lines of typical code; pick the language yourself for short or ambiguous snippets.
Accessible code images
An image of code cannot be read by screen readers or copied. When you post one, add the code as text or a link next to it, and use a theme with enough contrast — the light "Paper" theme suits printed documents best.