metonym / svelte-highlight

Syntax Highlighting for Svelte using highlight.js
https://svhe.onrender.com
MIT License
253 stars 13 forks source link

Support highlighted lines using `LineNumbers` #256

Closed metonym closed 1 year ago

metonym commented 1 year ago

It would be nice if specific lines could be highlighted in the LineNumbers component.

A prop called highlightedLines could accept an array of line indices to highlight (zero-indexed).

<LineNumbers {highlighted} highlightedLines={[0, 1]} />

A custom color could be applied through a style prop.

<LineNumbers
  {highlighted}
  highlightedLines={[0, 1]}
  --highlighted-background="rgba(255, 255, 255, 0.4)"
/>
nicholasmordecai commented 1 year ago

+1, this would be cool!