siyuan-note/siyuan · error
unsupported attribute view rich text style
Error message
unsupported attribute view rich text style
What it means
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.
Source
Thrown at kernel/av/value.go:1281
}
match := valueTextRichBuiltinStylePattern.FindStringSubmatch(value)
if 5 != len(match) || match[1] != match[3] || match[2] != valueSuffix || match[4] != legacySuffix {
return "", false
}
return fmt.Sprintf("var(--b3-inline-builtin-%s-%s, var(--b3-card-%s-%s))",
match[1], valueSuffix, match[1], legacySuffix), true
}
func normalizeValueTextRichTreeStyles(tree *parse.Tree) (err error) {
ast.Walk(tree.Root, func(node *ast.Node, entering bool) ast.WalkStatus {
if !entering || ast.NodeTextMark != node.Type || 1 > len(node.KramdownIAL) {
return ast.WalkContinue
}
style := node.IALAttr("style")
var normalized string
var ok bool
if normalized, ok = normalizeValueTextRichStyle(style); !ok {
err = fmt.Errorf("unsupported attribute view rich text style")
return ast.WalkStop
}
node.SetIALAttr("style", normalized)
node.Next.Tokens = parse.IAL2Tokens(node.KramdownIAL)
return ast.WalkContinue
})
return
}
func isAllowedValueTextRichBlockIAL(node *ast.Node) bool {
ial := parse.Tokens2IAL(node.Tokens)
if 1 > len(ial) {
return false
}
hasID := false
for _, attr := range ial {
if 2 != len(attr) {
return falseView on GitHub (pinned to 8641553a1f)
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
Example fix
// before content = "<span style=\"background:url(x);color:red\">t</span>" // after content = "<span style=\"color: var(--b3-font-color1)\">t</span>" // whitelisted style only
Defensive patterns
Strategy: validation
Validate before calling
if _, ok := av.NormalizeStyleForCheck(styleAttr); !ok { styleAttr = "" } // drop disallowed styles early Try / catch
if err != nil && strings.Contains(err.Error(), "unsupported attribute view rich text style") {
// strip style IALs and re-apply via the editor
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- unsupported attribute view rich text node [%s]
- ErrRichTextSpecMismatch
- unsupported attribute view rich text spec [%d]
- unsupported attribute view rich text format [%s]
- parse attribute view rich text failed
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/8bf9493a23d185d1.
Report an issue: GitHub.