Node - codeBlock

Purpose

The codeBlock node is a container for lines of code.

Type

codeBlock is a top-level block node.

Example

1
2
{
  "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: