Create a LineNumbers component to be composed with either Highlight, HighlightAuto, or HighlightSvelte. LineNumbers is its own component for performance reasons (i.e., do not punish consumers who do not use it with extra code).
Usage
highlighted code must be passed as prop to LineNumbers.
Closes #247, related #240
This adds support for line numbers.
Approach
Create a
LineNumbers
component to be composed with eitherHighlight
,HighlightAuto
, orHighlightSvelte
.LineNumbers
is its own component for performance reasons (i.e., do not punish consumers who do not use it with extra code).Usage
highlighted
code must be passed as prop toLineNumbers
.Basic
Hidden Border
Set
hideBorder
totrue
to hide the border of the line numbers column.Wrapped Lines
By default, overflowing horizontal content is contained by a scrollbar.
Set
wrapLines
totrue
to hide the border of the line numbers column.Custom Styles
Use
--style-props
to customize the following visual properties:--line-number-color
: text color of the line numbers--border-color
: color of the line numbers column--padding-left
: left padding fortd
elements--padding-right
: right padding fortd
elements