Skip to content

Commit

Permalink
feat(line-numbers): add startingLineNumber prop (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjebs authored Jan 1, 2023
1 parent 2d63ce7 commit 41f1665
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/LineNumbers.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
* @default false
*/
hideBorder?: boolean;
/**
* Specify which starting line number should be displayed.
* @default 1
*/
startingLineNumber?: number;
/**
* Set to `true` for lines to wrap.
Expand Down Expand Up @@ -59,6 +65,8 @@
export let hideBorder = false;
export let wrapLines = false;
export let startingLineNumber = 1;
const DIGIT_WIDTH = 12;
const MIN_DIGITS = 2;
Expand All @@ -73,7 +81,7 @@
<table>
<tbody class:hljs={true}>
{#each lines as line, i}
{@const lineNumber = i + 1}
{@const lineNumber = i + startingLineNumber}
{@const isFirst = i === 0}
{@const isLast = i === lines.length - 1}
<tr>
Expand Down

0 comments on commit 41f1665

Please sign in to comment.