Skip to content

CodeBlockOptions

CodeBlockOptions = object

Defined in: ssr/code-block.ts:6

optional class: string

Defined in: ssr/code-block.ts:43

Additional classes for the root element of the code block. Useful when styling individual code blocks. The pre.prism-code-editor selector can be used to style all code blocks.


optional guideIndents: boolean

Defined in: ssr/code-block.ts:32

Whether or not to display indentation guides. Does support wordWrap unlike the indentGuides() editor extension. Does not work with rtl.

false

language: string

Defined in: ssr/code-block.ts:11

Language used for syntax highlighting. If the language doesn’t have a registered Prism grammar, syntax highlighting will be disabled.


optional lineNumbers: boolean

Defined in: ssr/code-block.ts:17

Whether or not to display line numbers.

false

optional lineNumberStart: number

Defined in: ssr/code-block.ts:19

Line number of the first line.

1

optional preserveIndent: boolean

Defined in: ssr/code-block.ts:27

Whether or not indentation is preserved on wrapped lines. When true, tabs are replaced with spaces since Chrome doesn’t render tabs properly with this enabled. Defaults to true when wordWrap is enabled.


optional rtl: boolean

Defined in: ssr/code-block.ts:37

Whether the code block uses right to left directionality. Requires styles from prism-code-editor/rtl-layout.css to work.

false

optional tabSize: number

Defined in: ssr/code-block.ts:15

Number of spaces a tab is equal to.

2

value: string

Defined in: ssr/code-block.ts:13

Code in the code block.


optional wordWrap: boolean

Defined in: ssr/code-block.ts:21

Whether or not lines can wrap.

false

optional addLineClass(lineNumber): undefined | null | string

Defined in: ssr/code-block.ts:55

Callback function that can be used to add extra classes to lines. Multiple classes can be separated by spaces. Note that the lineNumberStart option does not affect the line number passed to the callback.

number

The line number of the line.

undefined | null | string


optional tokenizeCallback(tokens, language): void

Defined in: ssr/code-block.ts:48

Callback that can be used to modify the tokens before they’re stringified to HTML. Can be used to add rainbow brackets for example.

TokenStream

string

void