{"record":{"id":"8579d8f51078ab8f","repo":"siyuan-note/siyuan","slug":"attribute-view-rich-text-normalization-did-not-con","errorCode":null,"errorMessage":"attribute view rich text normalization did not converge","messagePattern":"attribute view rich text normalization did not converge","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/value.go","lineNumber":2139,"sourceCode":"\tfor iteration := 0; iteration < 4; iteration++ {\n\t\tif err = normalizeValueTextRichTreeStyles(normalizedTree); nil != err {\n\t\t\treturn \"\", nil, err\n\t\t}\n\t\tluteEngine := newValueTextRichLute()\n\t\tblockDOM := luteEngine.Tree2BlockDOM(normalizedTree, luteEngine.RenderOptions, luteEngine.ParseOptions)\n\t\tcontent = valueTextRichBlockDOM2Kramdown(luteEngine, blockDOM)\n\t\tif 0 < iteration && previous == content {\n\t\t\treturn content, normalizedTree, nil\n\t\t}\n\t\tprevious = content\n\t\tcandidate := &ValueTextRich{\n\t\t\tSpec: ValueTextRichSpec, Format: ValueTextRichFormatKramdown, Content: content,\n\t\t}\n\t\tif _, normalizedTree, err = parseValueTextRichWithImages(candidate, images); nil != err {\n\t\t\treturn \"\", nil, err\n\t\t}\n\t}\n\treturn \"\", nil, fmt.Errorf(\"attribute view rich text normalization did not converge\")\n}\n\n// NormalizeRichContent 校验富文本载荷，并根据富文本源刷新纯文本投影。\nfunc (value *ValueText) NormalizeRichContent() (err error) {\n\tif !value.IsRich() {\n\t\treturn\n\t}\n\ttree, err := NormalizeValueTextRich(value.Rich)\n\tif nil != err {\n\t\treturn err\n\t}\n\tvalue.Content = valueTextRichPlainContent(tree)\n\treturn\n}\n\nfunc valueTextRichPlainContent(tree *parse.Tree) string {\n\tif nil == tree || nil == tree.Root {\n\t\treturn \"\"","sourceCodeStart":2121,"sourceCodeEnd":2157,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/av/value.go#L2121-L2157","documentation":"Rich text normalization renders the parsed tree to Kramdown, re-parses, and repeats, expecting the round-trip to reach a fixed point. If after 4 iterations the content still keeps changing (or the first stable comparison never matches), the normalizer gives up with this error. It indicates content whose Kramdown representation is not stable under parse/render, usually due to unusual or nested constructs.","triggerScenarios":"Calling NormalizeValueTextRich / NormalizeRichContent with content that alternates representation on each parse/render cycle, e.g. entities that keep re-escaping, nested span/IAL constructs that re-nest each pass, or pathological style/entity combinations.","commonSituations":"Machine-generated rich text with deeply nested or redundant spans; content imported from another Markdown dialect with constructs Lute re-writes each pass; a Lute engine bug on new syntax.","solutions":["Simplify the content: remove nested/redundant span constructs and unusual entity escapes, then retry","Regenerate the content via the editor so it is emitted in Lute's canonical form","Minimize the failing snippet and report it upstream (Lute/SiYuan) as a normalization convergence bug","If the value is from an import, try importing without the offending constructs and apply them via the UI"],"exampleFix":"// before: content oscillating between forms\n<span data-type=\"text\" style=\"...\"><span data-type=\"text\">a</span></span>\n// after: flattened single span\n<span data-type=\"text\" style=\"...\">a</span>","handlingStrategy":"try-catch","validationCode":"// pre-check for suspicious nesting depth in generated rich text\nif ((content.match(/<span/g) || []).length > 20) {\n  console.warn(\"deeply nested spans may not normalize\");\n}","typeGuard":null,"tryCatchPattern":"try { NormalizeValueTextRich(rich) } catch (e) { if (String(e).includes(\"did not converge\")) { rich = simplifyAndFlatten(rich); retryOnce(); } }","preventionTips":["Keep generated rich text simple: flat spans, canonical entities","Emit content in Lute's canonical form by round-tripping once before saving","Report persistently non-converging snippets upstream as Lute bugs"],"tags":["attribute-view","rich-text","normalization","lute"],"backgroundTag":"internal-invariant-violation","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}