tiptap/validator

Search:
Group by:

Types

TipTapSchema = object
  whitelist*: set[TipTapNodeType] = {ttParagraph..ttBlockquote} ## A set of allowed node types in the TipTap content
  layoutRules*: seq[TipTapNodeType] ## A sequence defining allowed layout rules for nodes.
                                    ## 
                                    ## If empty, no layout rules are enforced, otherwise nodes must
                                    ## follow the specified order.
                                    ## 
                                    ## (e.g., [ttHeading, ttParagraph, ttImage])

Consts

defaultTipTapSchema = (whitelist: {ttParagraph..ttBlockquote}, layoutRules: [])

Procs

proc validate(content: TipTapContent; schema: TipTapSchema = defaultTipTapSchema): bool {.
    ...raises: [], tags: [], forbids: [].}
Validates the TipTap content structure using the provided JSON schema. If no schema is provided, it uses the default schema.