{"record":{"id":"8989ed7320683ae5","repo":"siyuan-note/siyuan","slug":"unsupported-attribute-view-rich-text-format-s","errorCode":null,"errorMessage":"unsupported attribute view rich text format [%s]","messagePattern":"unsupported attribute view rich text format \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/value.go","lineNumber":565,"sourceCode":"\treturn nil != value && nil != value.Rich\n}\n\n// ParseValueTextRich 校验并解析文本字段的富文本源。\nfunc ParseValueTextRich(rich *ValueTextRich) (tree *parse.Tree, err error) {\n\t_, tree, err = parseValueTextRich(rich)\n\treturn\n}\n\nfunc parseValueTextRich(rich *ValueTextRich) (blockDOM string, tree *parse.Tree, err error) {\n\tif nil == rich {\n\t\treturn\n\t}\n\tif ValueTextRichSpec != rich.Spec {\n\t\terr = fmt.Errorf(\"unsupported attribute view rich text spec [%d]\", rich.Spec)\n\t\treturn\n\t}\n\tif ValueTextRichFormatKramdown != rich.Format {\n\t\terr = fmt.Errorf(\"unsupported attribute view rich text format [%s]\", rich.Format)\n\t\treturn\n\t}\n\n\tluteEngine := newValueTextRichLute()\n\tcontent, protectedStyleEntities, protectErr := protectValueTextRichKramdownStyleEntities(rich.Content)\n\tif nil != protectErr {\n\t\terr = protectErr\n\t\treturn\n\t}\n\tblockDOM, tree = luteEngine.Md2BlockDOMTree(content, true)\n\tif nil == tree || nil == tree.Root {\n\t\terr = fmt.Errorf(\"parse attribute view rich text failed\")\n\t\treturn\n\t}\n\tif 0 < len(protectedStyleEntities) {\n\t\tif err = restoreValueTextRichTreeStyleEntities(tree, protectedStyleEntities); nil != err {\n\t\t\treturn\n\t\t}","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/av/value.go#L547-L583","documentation":"parseValueTextRich accepts exactly one serialization format, ValueTextRichFormatKramdown. After the spec check passes, a payload whose Format string is anything else (empty, \"markdown\", \"html\", etc.) is rejected with this error because the kramdown-specific protection/parsing pipeline cannot safely process other formats.","triggerScenarios":"ParseValueTextRich / NormalizeValueTextRich called with a ValueTextRich whose Format field was not set to av.ValueTextRichFormatKramdown — e.g. payloads built by external tools, migrated data, or code that forgot to set Format at all.","commonSituations":"Third-party exporters writing plain markdown into rich-text cells; hand-edited JSON where Format was dropped; plugins constructing ValueTextRich from scratch without the constant.","solutions":["Set Format to the av.ValueTextRichFormatKramdown constant when building the payload","Convert the content to kramdown and re-store it with the correct Format value","Re-edit the cell in SiYuan so the kernel serializes it in the supported format","If importing from another tool, transform the payload through the kernel's own save path instead of writing raw JSON"],"exampleFix":"// before\nrich := &av.ValueTextRich{Spec: av.ValueTextRichSpec, Format: \"markdown\", Content: text}\n// after\nrich := &av.ValueTextRich{Spec: av.ValueTextRichSpec, Format: av.ValueTextRichFormatKramdown, Content: text}","handlingStrategy":"type-guard","validationCode":"if rich.Format != av.ValueTextRichFormatKramdown { return fmt.Errorf(\"format %q not supported\", rich.Format) }","typeGuard":"func isKramdownFormat(r *av.ValueTextRich) bool { return r != nil && r.Format == av.ValueTextRichFormatKramdown }","tryCatchPattern":null,"preventionTips":["Build ValueTextRich only via kernel helpers that set Format correctly","Convert imported markdown to kramdown before storing rich text","Never hand-edit rich-text JSON in .sy/database storage"],"tags":["attribute-view","rich-text","format","kramdown"],"backgroundTag":"unsupported-enum-value","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}