Skip to content

Commit 430d676

Browse files
authored
Merge pull request #268 from ChristianAvila/tags-with-hyphen
feat: Supports hyphens in tags
2 parents 4cff03d + 53cf3fd commit 430d676

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/notes/file_system/file_system.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from ..models import Note, NoteCreate, NoteUpdate, SearchResult
2626

2727
MARKDOWN_EXT = ".md"
28-
INDEX_SCHEMA_VERSION = "4"
28+
INDEX_SCHEMA_VERSION = "5"
2929

3030
StemmingFoldingAnalyzer = StemmingAnalyzer() | CharsetFilter(accent_map)
3131

@@ -41,9 +41,11 @@ class IndexSchema(SchemaClass):
4141

4242

4343
class FileSystemNotes(BaseNotes):
44-
TAGS_RE = re.compile(r"(?:(?<=^#)|(?<=\s#))\w+(?=\s|$)")
44+
TAGS_RE = re.compile(r"(?:(?<=^#)|(?<=\s#))[a-zA-Z0-9_-]+(?=\s|$)")
4545
CODEBLOCK_RE = re.compile(r"`{1,3}.*?`{1,3}", re.DOTALL)
46-
TAGS_WITH_HASH_RE = re.compile(r"(?:(?<=^)|(?<=\s))#\w+(?=\s|$)")
46+
TAGS_WITH_HASH_RE = re.compile(
47+
r"(?:(?<=^)|(?<=\s))#[a-zA-Z0-9_-]+(?=\s|$)"
48+
)
4749

4850
def __init__(self):
4951
self.storage_path = get_env("FLATNOTES_PATH", mandatory=True)

0 commit comments

Comments
 (0)