🎨 Improve error tip when renaming tags/bookmarks containing Markdown markers Fix https://github.com/siyuan-note/siyuan/issues/9248

This commit is contained in:
Daniel 2023-09-28 11:50:42 +08:00
parent d51999f2df
commit 3ecebb224a
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 601 additions and 7 deletions

View file

@ -6,7 +6,7 @@
"id": "20200924100635-ms0p9lb",
"title": "Bookmark and Tag",
"type": "doc",
"updated": "20210702231509"
"updated": "20230928114919"
},
"Children": [
{
@ -182,6 +182,202 @@
"Data": "). If you need to cancel the tag, just delete the tag in the content block."
}
]
},
{
"ID": "20230928113947-gnlob5l",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20230928113947-gnlob5l",
"updated": "20230928113958"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "Note"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"ID": "20230928113959-ebzf9zy",
"Type": "NodeParagraph",
"Properties": {
"id": "20230928113959-ebzf9zy",
"updated": "20230928114919"
},
"Children": [
{
"Type": "NodeText",
"Data": "Do not use special symbols in bookmarks or tags, otherwise renaming in the bookmark or tag panel will not be possible. The \"special symbols\" here include: "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "*"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "_"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "["
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "]"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "!"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\\"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "`"
},
{
"Type": "NodeText",
"Data": " , "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026lt;"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026gt;"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026amp;"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "~ "
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "$"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "("
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ")"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "}"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "="
},
{
"Type": "NodeText",
"Data": " and "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "#"
},
{
"Type": "NodeText",
"Data": "."
}
]
}
]
}

View file

@ -6,7 +6,7 @@
"id": "20200910201551-h4twhas",
"title": "书签和标签",
"type": "doc",
"updated": "20210702231322"
"updated": "20230928114656"
},
"Children": [
{
@ -182,6 +182,202 @@
"Data": ")中列出。如果需要取消标签,在内容块中删掉该标签即可。"
}
]
},
{
"ID": "20230928114125-0cw4gus",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20230928114125-0cw4gus",
"updated": "20230928114129"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "注意"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"ID": "20230928114129-dirvllf",
"Type": "NodeParagraph",
"Properties": {
"id": "20230928114129-dirvllf",
"updated": "20230928114656"
},
"Children": [
{
"Type": "NodeText",
"Data": "请勿在书签或者标签中使用特殊符号,否则会导致无法在书签或标签面板中重命名。这里的“特殊符号”包括:"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "*"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "_"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "["
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "]"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "!"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\\"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "`"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026lt;"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026gt;"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026amp;"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "~"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "$"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "("
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ")"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "}"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "="
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "#"
},
{
"Type": "NodeText",
"Data": "​。"
}
]
}
]
}

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20211226123130-jpeg5b2",
"title": "書籤和標籤",
"updated": "20211226123145"
"updated": "20230928114931"
},
"Children": [
{
@ -167,7 +167,7 @@
},
{
"Type": "NodeText",
"Data": " / "
"Data": " / "
},
{
"Type": "NodeTextMark",
@ -176,7 +176,207 @@
},
{
"Type": "NodeText",
"Data": ")中列出。如果需要取消標簽,在內容塊中刪掉該標簽即可。"
"Data": "​)中列出。如果需要取消標簽,在內容塊中刪掉該標簽即可。"
}
]
},
{
"ID": "20230928114735-uks4kf5",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20230928114735-uks4kf5",
"updated": "20230928114758"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "注意"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"ID": "20230928114731-0nurd8j",
"Type": "NodeParagraph",
"Properties": {
"id": "20230928114731-0nurd8j",
"updated": "20230928114931"
},
"Children": [
{
"Type": "NodeText",
"Data": "請勿在書籤或標籤中使用特殊符號,否則會導致無法在書籤或標籤面板中重新命名。 這裡的「特殊符號」包括:"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "*"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "_"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "["
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "]"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "!"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\\"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "`"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026lt;"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026gt;"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\u0026amp;"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "~ "
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "$"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "("
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ")"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "}"
},
{
"Type": "NodeText",
"Data": "​、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "="
},
{
"Type": "NodeText",
"Data": " 和"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "#"
},
{
"Type": "NodeText",
"Data": "​。"
}
]
}

View file

@ -36,8 +36,10 @@ func ContainsMarker(str string) (ret string) {
func IsMarker(token byte) bool {
switch token {
case lex.ItemAsterisk, lex.ItemUnderscore, lex.ItemOpenBracket, lex.ItemBang, lex.ItemNewline, lex.ItemBackslash, lex.ItemBacktick, lex.ItemLess,
lex.ItemCloseBracket, lex.ItemAmpersand, lex.ItemTilde, lex.ItemDollar, lex.ItemOpenBrace, lex.ItemOpenParen, lex.ItemEqual, lex.ItemCrosshatch:
case lex.ItemAsterisk, lex.ItemUnderscore, lex.ItemOpenBracket, lex.ItemCloseBracket, lex.ItemNewline,
lex.ItemBang, lex.ItemBackslash, lex.ItemBacktick, lex.ItemLess, lex.ItemGreater,
lex.ItemAmpersand, lex.ItemTilde, lex.ItemDollar, lex.ItemOpenBrace, lex.ItemCloseBrace,
lex.ItemOpenParen, lex.ItemCloseParen, lex.ItemEqual, lex.ItemCrosshatch:
return true
case lex.ItemCaret:
return true