{"record":{"id":"8bf9493a23d185d1","repo":"siyuan-note/siyuan","slug":"unsupported-attribute-view-rich-text-style","errorCode":null,"errorMessage":"unsupported attribute view rich text style","messagePattern":"unsupported attribute view rich text style","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/value.go","lineNumber":1281,"sourceCode":"\t}\n\tmatch := valueTextRichBuiltinStylePattern.FindStringSubmatch(value)\n\tif 5 != len(match) || match[1] != match[3] || match[2] != valueSuffix || match[4] != legacySuffix {\n\t\treturn \"\", false\n\t}\n\treturn fmt.Sprintf(\"var(--b3-inline-builtin-%s-%s, var(--b3-card-%s-%s))\",\n\t\tmatch[1], valueSuffix, match[1], legacySuffix), true\n}\n\nfunc normalizeValueTextRichTreeStyles(tree *parse.Tree) (err error) {\n\tast.Walk(tree.Root, func(node *ast.Node, entering bool) ast.WalkStatus {\n\t\tif !entering || ast.NodeTextMark != node.Type || 1 > len(node.KramdownIAL) {\n\t\t\treturn ast.WalkContinue\n\t\t}\n\t\tstyle := node.IALAttr(\"style\")\n\t\tvar normalized string\n\t\tvar ok bool\n\t\tif normalized, ok = normalizeValueTextRichStyle(style); !ok {\n\t\t\terr = fmt.Errorf(\"unsupported attribute view rich text style\")\n\t\t\treturn ast.WalkStop\n\t\t}\n\t\tnode.SetIALAttr(\"style\", normalized)\n\t\tnode.Next.Tokens = parse.IAL2Tokens(node.KramdownIAL)\n\t\treturn ast.WalkContinue\n\t})\n\treturn\n}\n\nfunc isAllowedValueTextRichBlockIAL(node *ast.Node) bool {\n\tial := parse.Tokens2IAL(node.Tokens)\n\tif 1 > len(ial) {\n\t\treturn false\n\t}\n\thasID := false\n\tfor _, attr := range ial {\n\t\tif 2 != len(attr) {\n\t\t\treturn false","sourceCodeStart":1263,"sourceCodeEnd":1299,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/av/value.go#L1263-L1299","documentation":"As part of rich-text tree validation, every node's style IAL attribute is run through normalizeValueTextRichStyle, which whitelists the CSS style properties allowed in attribute-view rich text. If a style string cannot be normalized to the sanctioned form, the walk stops with this error (a fixed-message error variable, declared at kernel/av/value.go:1281). The unrelated \"USED AT app/electron/main.js\" references only show an Electron catch block capturing kernel errors, not this error's origin.","triggerScenarios":"Rich-text content whose spans/blocks carry style attributes with disallowed or malformed CSS (e.g. url() payloads, unknown properties, broken declarations). Reached through validateValueTextRichTree during ParseValueTextRich / NormalizeValueTextRich / RenderValueTextRich.","commonSituations":"Content pasted from external rich-text editors that injects arbitrary inline styles (font, position, background-url); hand-edited kramdown with custom style=\"...\" IALs; data written by older or third-party tooling.","solutions":["Strip the offending style attribute from the span/block in the cell content and re-apply only supported styles via the UI","Paste as plain text or use SiYuan's own style toolbar so only whitelisted style IALs are generated","Run the content through NormalizeValueTextRich so styles are normalized where possible before validation","Restore the cell from a snapshot if the styles came from corrupted third-party writes"],"exampleFix":"// before\ncontent = \"<span style=\\\"background:url(x);color:red\\\">t</span>\"\n// after\ncontent = \"<span style=\\\"color: var(--b3-font-color1)\\\">t</span>\" // whitelisted style only","handlingStrategy":"validation","validationCode":"if _, ok := av.NormalizeStyleForCheck(styleAttr); !ok { styleAttr = \"\" } // drop disallowed styles early","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unsupported attribute view rich text style\") {\n    // strip style IALs and re-apply via the editor\n}","preventionTips":["Apply styling only through the SiYuan editor's style controls","Strip arbitrary inline styles when importing HTML content","Avoid hand-writing style=\"...\" IALs in kramdown"],"tags":["attribute-view","rich-text","style-whitelist","sanitization"],"backgroundTag":"schema-validation-failed","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}