Types
TipTapContent = object content*: seq[TipTapNode] ## The content of the document, which is a sequence of `TipTapNode`
TipTapNode {.acyclic.} = ref object attrs*: Table[string, string] ## Attributes of the node, such as "bold", "italic", etc. case ## The type of the node, e.g., "paragraph", "text", etc. of ttText: text*: string ## The actual text content for text nodes else: content*: seq[TipTapNode] ## The content of the node, which can be a sequence of `TipTapNode` marks*: seq[TipTapNode] ## Marks applied to the node, such as "bold", "italic", 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", ttBlockquote = "blockquote"
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