LineNumbers

Renders line numbers for the CodeBlock component.

API Reference

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

LineNumbersProps

LineNumbersProps
Properties

highlightRanges

string | undefined

A string of comma separated lines and ranges to highlight.

css

CSSObject | undefined

CSS object to apply to the line numbers container.

className

string | undefined

Class name to apply to the line numbers container.

style

React.CSSProperties | undefined

Style to apply to the line numbers container.