tiptap/content

Types

TipTapContent = object
  content*: seq[TipTapNode]  ## The content of the document, which is a sequence of `TipTapNode`
Represents the entire TipTap document structure
TipTapNode {.acyclic.} = ref object
  case                      ## The type of the node, e.g., "paragraph", "text", etc.
  of ttText:
    text*: string            ## The actual text content for text nodes
    marks*: seq[TipTapNode]  ## Marks applied to the node, such as "bold", "italic", etc.
  else:
    content*: seq[TipTapNode] ## The content of the node, which can be a sequence of `TipTapNode`
  attrs*: Table[string, string] ## Attributes of the node, such as "bold", "italic", etc.
Represents a node in the TipTap document structure. This can be a text node, paragraph, heading, etc.
TipTapNodeType = enum
  ttCustom, ttParagraph = "paragraph", ttText = "text", ttHeading = "heading",
  ttBold = "bold", ttItalic = "italic", ttLink = "link",
  ttBulletList = "bulletList", ttOrderedList = "orderedList",
  ttListItem = "listItem", ttTaskList = "taskList", ttImage = "image",
  ttCodeBlock = "codeBlock", ttCode = "code", ttBlockquote = "blockquote",
  ttHighlight = "highlight"
Enumeration of allowed node types in the TipTap editor. This includes basic text formatting nodes, structural nodes like paragraphs and headings, and media nodes like images. Custom node types can also be added as needed

Procs

proc `$`(tt: TipTapContent): string {....raises: [Exception], tags: [RootEffect],
                                      forbids: [].}
Converts the TipTap document to a JSON string representation using pkg/jsony
proc addChild(parent: var TipTapNode; child: TipTapNode) {....raises: [], tags: [],
    forbids: [].}
Adds a child node to the parent node
proc getFirstParagraph(content: TipTapContent): Option[TipTapNode] {....raises: [],
    tags: [], forbids: [].}
Retrieves the first paragraph node from the TipTap content
proc newTipTapNode(typ: TipTapNodeType): TipTapNode {....raises: [], tags: [],
    forbids: [].}
Create a new TipTap node