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