Skip to main content

Code Block

Below you can view an example of the code block in JSON format.**

{
"type": "codex_code_block",
"attrs": {
"blockId": "blockId"
},
"content": [
{
"type": "text",
"text": "Some code"
}
],
"contentHTML": "<code><span class=\"hljs-string\">Some code</span></code>"
}

Below you can read details about each attribute of the code block

type

A string that represents the type of the block. Code blocks will always display codex_code_block as their type..

text

A string that represents the text written by the user in the code block.

content

An array of objects that represents the content of the block.

attrs

An object that represents the attributes of the block.

attrs.blockId

A string that represents the unique block ID of the code block.

contentHTML

A string that represents the generated HTML of the code block.