Rate this page:

Node - codeBlock

Purpose

The codeBlock node is a container for lines of code.

Type

codeBlock is a top-level block node.

Example

1
2
3
4
5
6
7
8
9
10
11
12
{
  "type": "codeBlock",
  "attrs": {
    "language": "javascript"
  },
  "content": [
    {
      "type": "text",
      "text": "var foo = {};\nvar bar = [];"
    }
  ]
}

Fields

NameRequiredTypeValue
typestring"codeBlock"
contentarrayAn array of nodes
attrsobject
attrs.languagestringLanguage of the code lines

Content

content takes an array of one or more text nodes without marks.

Attributes

Rate this page: