LineNumbers

API Reference

LineNumbers

(props: LineNumbersProps) => React.JSX.Element

Renders line numbers for the CodeBlock component.

Parameters
LineNumbersProps
Return
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
Return
(index: number) => boolean

LineNumbersProps

LineNumbersProps

Properties

tokens

Array<Array<Token>> | undefined

Tokens to render from getTokens.

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.