{"record":{"id":"8f12b1d6ebbea8ce","repo":"hcengineering/platform","slug":"token-type-node-type-not-supported-by-markdow","errorCode":null,"errorMessage":"Token type `${node.type}` not supported by Markdown renderer","messagePattern":"Token type `(.+?)` not supported by Markdown renderer","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/core/packages/text-markdown/src/serializer.ts","lineNumber":557,"sourceCode":"\n  // :: (string, ?bool)\n  // Add the given text to the document. When escape is not `false`,\n  // it will be escaped.\n  text (text: string, escape = false): void {\n    const lines = text.split('\\n')\n    for (let i = 0; i < lines.length; i++) {\n      const startOfLine = this.atBlank() || this.closed\n      this.write('')\n      this.out += escape ? this.esc(lines[i], startOfLine) : lines[i]\n      if (i !== lines.length - 1) this.out += '\\n'\n    }\n  }\n\n  // :: (Node)\n  // Render the given node as a block.\n  render (node: MarkupNode, parent: MarkupNode, index: number): void {\n    if (this.nodes[node.type] === undefined) {\n      throw new Error('Token type `' + node.type + '` not supported by Markdown renderer')\n    }\n    this.nodes[node.type](this, node, parent, index)\n  }\n\n  // :: (Node)\n  // Render the contents of `parent` as block nodes.\n  renderContent (parent: MarkupNode): void {\n    nodeContent(parent).forEach((node: MarkupNode, i: number) => {\n      this.render(node, parent, i)\n    })\n  }\n\n  reorderMixableMark (state: InlineState, mark: MarkupMark, i: number, len: number): void {\n    for (let j = 0; j < state.active.length; j++) {\n      const other = state.active[j]\n      if (!this.marks[other.type].mixable || this.checkSwitchMarks(i, j, state, mark, other, len)) {\n        break\n      }","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/core/packages/text-markdown/src/serializer.ts#L539-L575","documentation":"The Markdown serializer's render() method dispatches to a per-node-type renderer looked up in this.nodes. If a node's type has no registered renderer, the serializer cannot produce Markdown for it and throws this error instead of silently emitting wrong output.","triggerScenarios":"Passing a document containing a node type the Markdown renderer does not support (e.g. a custom node, hard-break, or a node kind only valid in HTML/other renderers) to render(), called via renderContent, checkOpenMarks, or renderListItem.","commonSituations":"Custom node types added via plugins, documents round-tripped from other formats introducing unsupported nodes, or upgrading the document schema without updating renderer node registrations.","solutions":["Remove or convert unsupported node types before rendering (e.g. map them to supported paragraphs/text)","Register a renderer for the node type in the serializer's nodes table","Check document contents with a filter step that drops or rewrites unknown node types"],"exampleFix":"// before\nrender(doc) // doc contains custom 'embed' node -> throws\n// after\nconst filtered = doc.filter(n => supportedTypes.has(n.type))\nrender(filtered)","handlingStrategy":"validation","validationCode":"const supported = new Set(['paragraph','heading','bulletList','orderedList','listItem','codeBlock','blockquote'])\nif (!supported.has(node.type)) throw new Error(`node ${node.type} not renderable to markdown`)","typeGuard":"function isRenderable(node: { type: string }, supported: Set<string>): boolean {\n  return supported.has(node.type)\n}","tryCatchPattern":"try {\n  serializer.render(node, parent, index)\n} catch (e) {\n  if (e.message.includes('not supported by Markdown renderer')) {\n    return fallbackRender(node)\n  }\n  throw e\n}","preventionTips":["Keep custom node types registered in the serializer's nodes table","Run documents through a sanitizer that drops unknown node types before export","Add a test that serializes every node type in your schema"],"tags":["markdown","serialization","unsupported-node"],"backgroundTag":"markdown-unsupported-node-type","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}