siyuan-note/siyuan · error

unsupported attribute view rich text format [%s]

Error message

unsupported attribute view rich text format [%s]

What it means

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.

Source

Thrown at kernel/av/value.go:565

	return nil != value && nil != value.Rich
}

// ParseValueTextRich 校验并解析文本字段的富文本源。
func ParseValueTextRich(rich *ValueTextRich) (tree *parse.Tree, err error) {
	_, tree, err = parseValueTextRich(rich)
	return
}

func parseValueTextRich(rich *ValueTextRich) (blockDOM string, tree *parse.Tree, err error) {
	if nil == rich {
		return
	}
	if ValueTextRichSpec != rich.Spec {
		err = fmt.Errorf("unsupported attribute view rich text spec [%d]", rich.Spec)
		return
	}
	if ValueTextRichFormatKramdown != rich.Format {
		err = fmt.Errorf("unsupported attribute view rich text format [%s]", rich.Format)
		return
	}

	luteEngine := newValueTextRichLute()
	content, protectedStyleEntities, protectErr := protectValueTextRichKramdownStyleEntities(rich.Content)
	if nil != protectErr {
		err = protectErr
		return
	}
	blockDOM, tree = luteEngine.Md2BlockDOMTree(content, true)
	if nil == tree || nil == tree.Root {
		err = fmt.Errorf("parse attribute view rich text failed")
		return
	}
	if 0 < len(protectedStyleEntities) {
		if err = restoreValueTextRichTreeStyleEntities(tree, protectedStyleEntities); nil != err {
			return
		}

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Set Format to the av.ValueTextRichFormatKramdown constant when building the payload
  2. Convert the content to kramdown and re-store it with the correct Format value
  3. Re-edit the cell in SiYuan so the kernel serializes it in the supported format
  4. If importing from another tool, transform the payload through the kernel's own save path instead of writing raw JSON

Example fix

// before
rich := &av.ValueTextRich{Spec: av.ValueTextRichSpec, Format: "markdown", Content: text}
// after
rich := &av.ValueTextRich{Spec: av.ValueTextRichSpec, Format: av.ValueTextRichFormatKramdown, Content: text}
Defensive patterns

Strategy: type-guard

Validate before calling

if rich.Format != av.ValueTextRichFormatKramdown { return fmt.Errorf("format %q not supported", rich.Format) }

Type guard

func isKramdownFormat(r *av.ValueTextRich) bool { return r != nil && r.Format == av.ValueTextRichFormatKramdown }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/8989ed7320683ae5. Report an issue: GitHub.