CodeBlockOptions
CodeBlockOptions =
object
Defined in: ssr/code-block.ts:6
Properties
Section titled “Properties”class?
Section titled “class?”
optionalclass: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.
guideIndents?
Section titled “guideIndents?”
optionalguideIndents: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.
Default
Section titled “Default”falselanguage
Section titled “language”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.
lineNumbers?
Section titled “lineNumbers?”
optionallineNumbers:boolean
Defined in: ssr/code-block.ts:17
Whether or not to display line numbers.
Default
Section titled “Default”falselineNumberStart?
Section titled “lineNumberStart?”
optionallineNumberStart:number
Defined in: ssr/code-block.ts:19
Line number of the first line.
Default
Section titled “Default”1preserveIndent?
Section titled “preserveIndent?”
optionalpreserveIndent: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.
optionalrtl: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.
Default
Section titled “Default”falsetabSize?
Section titled “tabSize?”
optionaltabSize:number
Defined in: ssr/code-block.ts:15
Number of spaces a tab is equal to.
Default
Section titled “Default”2value:
string
Defined in: ssr/code-block.ts:13
Code in the code block.
wordWrap?
Section titled “wordWrap?”
optionalwordWrap:boolean
Defined in: ssr/code-block.ts:21
Whether or not lines can wrap.
Default
Section titled “Default”falseMethods
Section titled “Methods”addLineClass()?
Section titled “addLineClass()?”
optionaladdLineClass(lineNumber):string|null|undefined
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.
Parameters
Section titled “Parameters”lineNumber
Section titled “lineNumber”number
The line number of the line.
Returns
Section titled “Returns”string | null | undefined
tokenizeCallback()?
Section titled “tokenizeCallback()?”
optionaltokenizeCallback(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.
Parameters
Section titled “Parameters”tokens
Section titled “tokens”language
Section titled “language”string
Returns
Section titled “Returns”void