{"record":{"id":"dd9d5fe6df00d1b6","repo":"siyuan-note/siyuan","slug":"do-not-include-markdown-syntax-marker-s-dd9d5f","errorCode":null,"errorMessage":"Do not include Markdown syntax marker [%s]","messagePattern":"Do not include Markdown syntax marker \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/tag.go","lineNumber":128,"sourceCode":"\n\tindexHistoryDir(filepath.Base(historyDir), util.NewLute())\n\tsql.FlushQueue()\n\n\treloadTreeIDs = gulu.Str.RemoveDuplicatedElem(reloadTreeIDs)\n\tfor _, id := range reloadTreeIDs {\n\t\tReloadProtyle(id)\n\t}\n\n\tupdateAttributeViewBlockText(updateNodes)\n\n\tsql.FlushQueue()\n\tutil.PushClearProgress()\n\treturn\n}\n\nfunc RenameTag(oldLabel, newLabel string) (err error) {\n\tif invalidChar := treenode.ContainsMarker(newLabel); \"\" != invalidChar {\n\t\treturn fmt.Errorf(Conf.Language(112), invalidChar)\n\t}\n\n\tnewLabel = strings.TrimPrefix(newLabel, \"/\")\n\tnewLabel = strings.TrimSuffix(newLabel, \"/\")\n\tnewLabel = strings.TrimSpace(newLabel)\n\n\tif \"\" == newLabel {\n\t\treturn errors.New(Conf.Language(114))\n\t}\n\n\tif oldLabel == newLabel {\n\t\treturn\n\t}\n\n\tutil.PushEndlessProgress(Conf.Language(110))\n\tutil.RandomSleep(500, 1000)\n\n\ttags := sql.QueryTagSpansByLabel(oldLabel)","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/model/tag.go#L110-L146","documentation":"RenameTag checks the new label first with treenode.ContainsMarker; if it returns a Markdown syntax marker character, i18n key 112 ('Do not include Markdown syntax marker [%s]') is returned with the offending character. Tag labels are written into documents as '#tag' text, so marker characters would corrupt rendering; this validation runs before any trimming and before any SQL or tree work.","triggerScenarios":"Renaming a tag to a label containing Markdown marker characters (such as #, *, _, ~, [, ]) via /api/tag/renameTag or the tag panel.","commonSituations":"Trying to style a tag like '**important**'; adding a '#' prefix; pasting formatted text into the rename dialog.","solutions":["Remove the reported marker character from the new label and retry","Keep tags to plain words, CJK, digits and safe separators like '-'"],"exampleFix":"// before\nmodel.RenameTag(\"work\", \"#work-urgent**\")\n// after\nmodel.RenameTag(\"work\", \"work-urgent\")","handlingStrategy":"validation","validationCode":"func hasNoMarkdownMarkers(label string) bool {\n\treturn treenode.ContainsMarker(label) == \"\"\n}\n\nif !hasNoMarkdownMarkers(newLabel) {\n\treturn fmt.Errorf(\"label %q contains Markdown marker characters\", newLabel)\n}\nmodel.RenameTag(oldLabel, newLabel)","typeGuard":"func hasNoMarkdownMarkers(label string) bool {\n\treturn treenode.ContainsMarker(label) == \"\"\n}","tryCatchPattern":null,"preventionTips":["Filter Markdown marker characters from tag rename inputs client-side","Keep tags as plain words; use hyphens instead of styling characters"],"tags":["tag","rename","markdown","validation"],"backgroundTag":"invalid-tag-characters","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}