siyuan-note/siyuan · error

unsupported attribute view rich text style

Error message

unsupported attribute view rich text style

What it means

While normalizing kramdown IAL styles on the rich text tree, normalizeValueTextRichStyle could not normalize a node's style attribute into the allowed style set. The kernel enforces an allowlist of CSS properties on rich text spans; a style declaration outside that set (or malformed) aborts the walk with this error, keeping stored styles limited to editor-supported properties.

Solutions

  1. Edit the cell in the SiYuan editor and re-apply the style from the editor's toolbar so the style is regenerated from the allowlist
  2. Remove or reduce the offending style attribute to supported properties (e.g. standard color/background/weight values the editor emits)
  3. Check kernel/av/value.go normalizeValueTextRichStyle for the accepted style set and adjust content to match
  4. If content came from a newer version with more style properties, upgrade the kernel so the allowlist covers it

Example fix

// before
{: style="position:absolute;top:0;"}
// after
{: style="color:#f00;"}
Defensive patterns

Strategy: validation

Validate before calling

// only emit styles the editor produces; allowlist check before storing
allowed := map[string]bool{"color": true, "background-color": true, "font-weight": true}

Prevention

When it happens

Trigger: Rich text content whose span style IAL contains a non-allowed CSS property/value (e.g. custom style="color:red;font-size:99px" or an unrecognized property), reaching the normalization walk via parseValueTextRichWithImages/restore/validate paths declared around kernel/av/value.go:1289.

Common situations: Data written by plugins or older versions using styles the current allowlist rejects; hand-edited .sy/DB content; copying styled content from other tools; a pasted span with arbitrary CSS.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/8bf9493a23d185d1. Report an issue: GitHub.

Appendix: source

Thrown at kernel/av/value.go:1289

	}
	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 false

View on GitHub (pinned to 9f775e8a12)