{"record":{"id":"d4db31cc92c21b12","repo":"siyuan-note/siyuan","slug":"invalid-attribute-view-rich-text-span-style-ial","errorCode":null,"errorMessage":"invalid attribute view rich text span style IAL","messagePattern":"invalid attribute view rich text span style IAL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/value.go","lineNumber":1522,"sourceCode":"\t\tstart := strings.Index(markdown[cursor:], marker)\n\t\tif 0 > start {\n\t\t\tbuilder.WriteString(markdown[cursor:])\n\t\t\tbreak\n\t\t}\n\t\tstart += cursor\n\t\tbuilder.WriteString(markdown[cursor:start])\n\t\tfor literalRangeIndex < len(literalRanges) && literalRanges[literalRangeIndex].end <= start {\n\t\t\tliteralRangeIndex++\n\t\t}\n\t\tif literalRangeIndex < len(literalRanges) && literalRanges[literalRangeIndex].start <= start {\n\t\t\tbuilder.WriteString(marker)\n\t\t\tcursor = start + len(marker)\n\t\t\tcontinue\n\t\t}\n\t\tialStart := start + len(\"</span>\")\n\t\tvalueStart, valueEnd, ialEnd, ok := valueTextRichSpanIALStyleBounds(markdown[ialStart:])\n\t\tif !ok {\n\t\t\treturn \"\", nil, fmt.Errorf(\"invalid attribute view rich text span style IAL\")\n\t\t}\n\t\tvalueStart += ialStart\n\t\tvalueEnd += ialStart\n\t\tialEnd += ialStart\n\t\tbuilder.WriteString(markdown[start:valueStart])\n\t\tstyle, protected := protectValueTextRichStyleEntities(markdown[valueStart:valueEnd],\n\t\t\tsentinel, len(protections))\n\t\tbuilder.WriteString(style)\n\t\tprotections = append(protections, protected...)\n\t\tbuilder.WriteString(markdown[valueEnd:ialEnd])\n\t\tcursor = ialEnd\n\t}\n\treturn builder.String(), protections, nil\n}\n\nfunc valueTextRichSpanIALStyleBounds(ial string) (valueStart, valueEnd, end int, ok bool) {\n\tif !strings.HasPrefix(ial, \"{: \") && !strings.HasPrefix(ial, \"{:\\t\") &&\n\t\t!strings.HasPrefix(ial, \"{:\\n\") && !strings.HasPrefix(ial, \"{:\\r\") {","sourceCodeStart":1504,"sourceCodeEnd":1540,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/av/value.go#L1504-L1540","documentation":"When scanning kramdown markdown for span-level style IALs (protectValueTextRichStyleEntities / the span-style scanning pass), a closing </span> was found but the following style attribute bounds could not be located — the IAL after the closing tag is missing or malformed. The scanner requires the exact pattern of a span whose style value sits between recognizable bounds so it can protect entity-encoding; anything else is rejected as invalid.","triggerScenarios":"Rich text content containing </span> followed by something other than a well-formed IAL style attribute (e.g. \"</span>{: ...\" missing closing brace, missing style= key, stray text after the closing tag before the IAL), processed through the span style protection pass on kernel/av/value.go around line 1522.","commonSituations":"Hand-edited or machine-spliced kramdown where the span markup and IAL got separated; truncated content from a failed write; content copied from another kramdown dialect with slightly different IAL syntax.","solutions":["Fix the markup so each </span> is directly followed by a well-formed kramdown IAL like {: style=\"...\"} on the same construct","Remove stray characters between the closing tag and the IAL, or delete the orphaned </span> entirely","Re-generate the content from the SiYuan editor (edit the cell and re-apply formatting) rather than editing stored kramdown by hand","Validate with lute: parse the content in isolation (Md2BlockDOMTree) to confirm the span/IAL structure is intact"],"exampleFix":"// before\n<span style=\"color:#f00\">text</span> color: red\n// after\n<span style=\"color:#f00\">text</span>{: style=\"color:#f00\"}","handlingStrategy":"validation","validationCode":"// every closing span must be immediately followed by {: style=\"...\"}\nre := regexp.MustCompile(`</span>[^{]`)\nif re.MatchString(content) { return errors.New(\"orphaned </span> without IAL\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never edit stored kramdown by hand; regenerate via the editor","Keep span tags and their IALs contiguous with no interleaved text","Validate content with lute parse before persisting programmatically","Escape stray literal </span> text in content"],"tags":["attribute-view","rich-text","kramdown","markup"],"backgroundTag":"invalid-argument-format","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"}