LineNumbers

Renders line numbers for the CodeBlock component.

API Reference

LineNumbersProps

LineNumbersProps
Properties

highlightRanges

string

A string of comma separated lines and ranges to highlight.

css

CSSObject

CSS object to apply to the line numbers container.

className

string

Class name to apply to the line numbers container.

style

React.CSSProperties

Style to apply to the line numbers container.

LineNumbers

({ highlightRanges: highlightRangesProp, css, className, style, }: LineNumbersProps) => Promise<React.JSX.Element>

Renders line numbers for the CodeBlock component.

Parameters
LineNumbersProps
Returns
Promise<Element>

calculateLinesToHighlight

(ranges: string | undefined) => (index: number) => boolean

Calculate which lines to highlight based on the range meta string added by the rehype plugin.

Parameters

ranges *

string | undefined
Returns
(index: number) => boolean