The codeBlock
node is a container for lines of code.
codeBlock
is a top-level block node.
1 2{ "type": "codeBlock", "attrs": { "language": "javascript" }, "content": [ { "type": "text", "text": "var foo = {};\nvar bar = [];" } ] }
Name | Required | Type | Value |
---|---|---|---|
type | ✔ | string | "codeBlock" |
content | array | An array of nodes | |
attrs | object | ||
attrs.language | string | Language of the code lines |
content
takes an array of one or more text
nodes without marks.
language
for syntax highlighting, a code language supported by Prism.
See available languages imports
for a list of the languages supported in Prism. If set to text
or an unsupported value, code is
rendered as plain, monospaced text.Rate this page: