<div class="code-block">
<div class="code-block-header">
<div class="code-block-title"><span class="code-block-lang">py</span></div>
<div class="code-block-actions">
<button class="code-block-btn">Copy</button>
</div>
</div>
<div class="code-block-content">
<div class="code-block-line-numbers">
<span class="code-block-line-number">1</span>
<span class="code-block-line-number">2</span>
<span class="code-block-line-number code-block-line-number-highlight">3</span>
<span class="code-block-line-number code-block-line-number-highlight">4</span>
<span class="code-block-line-number">5</span>
</div>
<div class="code-block-code"><span class="token-keyword">def</span> <span class="token-function">greet</span><span class="token-punctuation">(</span><span class="token-variable">name</span><span class="token-punctuation">)</span><span class="token-punctuation">:</span>
<span class="token-comment"># Format greeting</span>
<span class="code-block-line code-block-line-highlight"> <span class="token-variable">message</span> <span class="token-operator">=</span> <span class="token-string">f"Hello, {name}!"</span></span>
<span class="code-block-line code-block-line-highlight"> <span class="token-keyword">return</span> <span class="token-variable">message</span></span>
<span class="token-function">print</span><span class="token-punctuation">(</span><span class="token-function">greet</span><span class="token-punctuation">(</span><span class="token-string">"World"</span><span class="token-punctuation">)</span><span class="token-punctuation">)</span></div>
</div>
</div>
Requires: ux.min.css
<div class="relative overflow-x-auto rounded-xl font-mono text-sm leading-relaxed" style="background: #1e1e2e; color: #cdd6f4;">
<div class="flex items-center justify-between px-4 py-3" style="background: #181825; border-bottom: 1px solid #313244;">
<span class="text-xs uppercase tracking-wide px-2 py-0.5 rounded" style="background: #313244; color: #a6adc8; font-size: 0.6875rem;">py</span>
<button class="text-xs px-2.5 py-1.5 rounded border-none cursor-pointer" style="color: #6c7086; background: transparent;">Copy</button>
</div>
<div class="flex overflow-x-auto">
<div class="flex flex-col shrink-0 select-none py-4" style="background: rgba(0,0,0,0.2); border-right: 1px solid #313244;">
<span class="text-right px-4 text-xs leading-relaxed" style="color: #585b70;">1</span>
<span class="text-right px-4 text-xs leading-relaxed" style="color: #585b70;">2</span>
<span class="text-right px-4 text-xs leading-relaxed" style="color: #a6adc8; background: rgba(139,92,246,0.15);">3</span>
<span class="text-right px-4 text-xs leading-relaxed" style="color: #a6adc8; background: rgba(139,92,246,0.15);">4</span>
<span class="text-right px-4 text-xs leading-relaxed" style="color: #585b70;">5</span>
</div>
<pre class="flex-1 m-0 p-4 overflow-visible whitespace-pre bg-transparent" style="font: inherit;"><code><span style="color: #cba6f7;">def</span> <span style="color: #89b4fa;">greet</span><span style="color: #a6adc8;">(</span><span style="color: #f38ba8;">name</span><span style="color: #a6adc8;">)</span><span style="color: #a6adc8;">:</span>
<span style="color: #585b70; font-style: italic;"># Format greeting</span>
<span class="block px-2" style="background: rgba(139,92,246,0.15); border-left: 3px solid #8b5cf6;"> <span style="color: #f38ba8;">message</span> <span style="color: #94e2d5;">=</span> <span style="color: #a6e3a1;">f"Hello, {name}!"</span></span>
<span class="block px-2" style="background: rgba(139,92,246,0.15); border-left: 3px solid #8b5cf6;"> <span style="color: #cba6f7;">return</span> <span style="color: #f38ba8;">message</span></span>
<span style="color: #89b4fa;">print</span><span style="color: #a6adc8;">(</span><span style="color: #89b4fa;">greet</span><span style="color: #a6adc8;">(</span><span style="color: #a6e3a1;">"World"</span><span style="color: #a6adc8;">)</span><span style="color: #a6adc8;">)</span></code></pre>
</div>
</div>
Requires: tw.min.css
// No JavaScript required for static highlighting