Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Jul 5, 2024
1 parent a1c8eb9 commit 6099562
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
import rehypeParse from 'rehype-parse';
import { visit } from 'unist-util-visit';
import rangeParser from 'parse-numeric-range';
import { reverseString } from './chars/utils';
import { unified, type Transformer } from 'unified';
import { charsHighlighter } from './chars/charsHighlighter';
import { toString as hastToString } from 'hast-util-to-string';
Expand Down Expand Up @@ -435,14 +434,16 @@ export function rehypePrettyCode(
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
visit(codeTree, 'element', (element) => {
if (element.tagName === 'code') {
const showLineNumbers = /(?:^|\s)showLineNumbers(?:\s|$)/.test(meta);
const showLineNumbers = /(?:^|\s)showLineNumbers(?:\s|$)/.test(
meta,
);
if (showLineNumbers) {
if (element.properties) {
element.properties['data-line-numbers'] = '';
}

const lineNumbersStartAtMatch = meta.match(
/showLineNumbers=(\d+)/
/showLineNumbers=(\d+)/,
);
const startNumberString = lineNumbersStartAtMatch?.[1];
if (startNumberString) {
Expand Down

0 comments on commit 6099562

Please sign in to comment.