mirror of https://github.com/usememos/memos.git
fix: allow ampersand in tags to support compound tags
This commit is contained in:
parent
f7d370dba1
commit
177a74e82b
|
|
@ -51,7 +51,8 @@ func isValidTagRune(r rune) bool {
|
|||
// Underscore: word separation (snake_case)
|
||||
// Hyphen: word separation (kebab-case)
|
||||
// Forward slash: hierarchical tags (category/subcategory)
|
||||
if r == '_' || r == '-' || r == '/' {
|
||||
// Ampersand: compound tags (science&tech)
|
||||
if r == '_' || r == '-' || r == '/' || r == '&' {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,12 @@ func TestTagParser(t *testing.T) {
|
|||
expectedTag: "work-notes",
|
||||
shouldParse: true,
|
||||
},
|
||||
{
|
||||
name: "tag with ampersand",
|
||||
input: "#science&tech",
|
||||
expectedTag: "science&tech",
|
||||
shouldParse: true,
|
||||
},
|
||||
{
|
||||
name: "tag with underscore",
|
||||
input: "#2024_plans",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ function isTagChar(char: string): boolean {
|
|||
return true;
|
||||
}
|
||||
|
||||
return char === "_" || char === "-" || char === "/";
|
||||
return char === "_" || char === "-" || char === "/" || char === "&";
|
||||
}
|
||||
|
||||
function parseTagsFromText(text: string): Array<{ type: "text"; value: string } | { type: "tag"; value: string }> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue