Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'#' symbol in MarkdownFile tags property #9

Open
danymat opened this issue Feb 20, 2021 · 1 comment
Open

'#' symbol in MarkdownFile tags property #9

danymat opened this issue Feb 20, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@danymat
Copy link
Owner

danymat commented Feb 20, 2021

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', '#'})]
@danymat danymat added the bug Something isn't working label Feb 20, 2021
@robinFdr
Copy link

robinFdr commented Aug 17, 2023

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 != ""]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants