New mdast nodes

August 26, 2019 ยท View on GitHub

This project adds several new mdast nodes, documented here.

Table of Contents

Nodes

Inline Redaction

interface InlineRedaction <: Node {
  type: "inlineRedaction"
}

InlineRedaction includes Redaction

InlineRedaction (Node) represents an inline node which has been redacted from the original document.

Block Redaction

interface BlockRedaction <: Parent {
  type: "blockRedaction",
  children: [PhrasingContent]
}

BlockRedaction includes Redaction

BlockRedaction (Parent) represents a block node which has been redacted from the original document.

The original node's children may be redacted as well, or they may be preserved in the BlockRedaction node.

Inline Restoration

interface InlineRestoration <: Node {
  type: "inlineRestoration"
}

InlineRestoration includes Restoration

InlineRestoration (Node) represents an inline node which has been redacted from the original document and needs to be restored.

Block Restoration

interface BlockRestoration <: Parent {
  type: "blockRestoration",
  children: [PhrasingContent]
}

BlockRestoration includes Restoration

BlockRestoration (Parent) represents a block node which has been redacted from the original document and needs to be restored.

The original node's children may also need to be restored.

Mixins

Redaction

interface mixin Redaction {
  redactionContent: [StaticPhrasingContent]?,
  redactionData: object?,
  redactionType: string
}

Redaction represents a node which has replaced ("redacted") another node.

A redactionType field must be present. It represents the type value of the node it is replacing, and should match that value exactly.

A redactionContent field can optionally be present. It represents the content that will be rendered.

A redactionData field can optionally be present. It represents all data necessary for the original node to be reconstructed.

Restoration

interface mixin Restoration {
  content: [StaticPhrasingContent]?,
  redactionIndex: int?
}

Restoration represents a node which needs to be restored.

A redactionIndex field must be present. It represents the index of the redaction.

A content field can optionally be present. It represents the content that will be rendered.