Line numbers

Gutters and line metadata for code content.

Line numbers

The LineNumberRenderable adds gutters and aligns line metadata with code or text. Enable line numbers on a Code renderable or use it standalone to display diagnostics alongside plain text.

<line_number
  content={source()}
  lineNumbers
  highlightedLines={[3, 7, 11]}
/>

Highlight specific lines by passing an array of line indices. You can combine this with diff or diagnostic renderables for rich editors.

Props

PropTypeNotes
contentstringText/code whose lines are numbered.
lineNumbersbooleanEnable the gutter itself.
highlightedLinesnumber[]Line indexes to highlight (breakpoints/errors/active line).