Obsidian-Markdown-Parser
Obsidian-Markdown-Parser copied to clipboard
'#' symbol in MarkdownFile tags property
If a file has a tag, it will cause issues in retrieving the tags from the MarkdownFile object. Certain tags will be retrieved, and others Objects will have the tag property like : {'#'}
[(file.fileName, file.tags) for file in parser.mdFiles if len(file.tags) != 0]
[('La pratique sans but.md', {'#'}), ('Lignes directives de la méditation.md', {'develop'}), ("L'indépendance de chaque phénomène.md", {'#'}), ('Privilégier la feature au design.md', {'design'}), ("De l'être et du devenir.md", {'essais'}), ('About Art.md', {'essais'}), ('Gamification.md', {'gamification'}), ('Cygne Noir.md', {'cygneNoir'}), ('Non-être.md', {'#'}), ('Du brouillard magique.md', {'essais'}), ('Du voyage.md', {'essais'}), ('La voie de chemin de fer.md', {'#'}), ('Activité.md', {'develop'}), ("Du processus de création d'une note.md", {'personalManagement'}), ('La vraie nature.md', {'méditation', '#'}), ('Méditation.md', {'develop', '#'})]
This is due to the regex used in MardownFile.py
simpleTags = re.compile(r"((?<=#)\S+)")
Which results in
### Heading 3 is being read as tag: ##
my solution would be
for find in re.compile(r"^#([^\s#]+)|\s#([^\s^#]+)").findall(content):
[tags.append(tag) for tag in find if tag != ""]