Search and jump to any tool. Type to filter; use arrow keys to move and Enter to select.
Paste a snippet of source code and get it back coloured the way an editor would show it, ready to drop into a blog post, slide deck, email or documentation page.
Paste a snippet of source code and get it back coloured the way an editor would show it, ready to drop into a blog post, slide deck, email or documentation page. Tokens are coloured by highlight.js grammars running in your browser, and the result can leave as a self-contained HTML block with every colour written inline, as rich text for word processors, or as a PNG picture.
def add(a, b):
return a + b<pre style="...background:#0d1117..."><code><span style="color:#ff7b72">def</span> <span style="color:#d2a8ff">add</span>(a, b):
<span style="color:#ff7b72">return</span> a + b</code></pre>Good to know. Highlighting colours tokens only; it does not reformat or re-indent your code, so fix the layout first with a formatter if needed. Tabs are drawn four spaces wide in the PNG. Line numbers are marked non-selectable in the HTML, so copying text from the pasted block does not pick them up.
Preview
// Debounce a function so it runs once the calls stopexport function debounce<T extends (...args: never[]) => void>(fn: T, wait = 200) { let timer: ReturnType<typeof setTimeout> | undefined return (...args: Parameters<T>) => { clearTimeout(timer) timer = setTimeout(() => fn(...args), wait) }}