Open esodesod opened 2 days ago
To clarify the issue here, the problem is only with the # character, or have you encountered others?
Well, I only encountered the #
character, but now you got me curious if I could test the remaining "invalid" (Obsidian) characters as well :-).
I really don't know if this is the correct approach to "hard code a title" in combination with filters, but if I test using something like {{title|replace:"app":"NewApp #1!^[]|"|safe_name}}
for note name, and using your post https://stephango.com/file-over-app, it seems to still produce all the invalid characters with the exception of |
being "sanitized" (EDIT: but maybe that needs escaping?). I'm no coder/developer, but by the look of the regex in safe_filter, I guess it's done here somewhere? https://github.com/obsidianmd/obsidian-clipper/blob/bea800d5894876e6ef2bc0a9c57d4b443dc5e66a/src/utils/filters/safe_name.ts#L26
Might just be a "personal preference" (in my case), but I'd like a filter (or safe_name
) to be able to produce a note name that is "safe to use in Obsidian"; meaning all characters that possibly could produce issues within Obsidian are sanitized, if that makes sense.
Not directly a bug, but I (intially) though that
safe_name
filter supposed to result in a "safe name"? Maybe not limited to (only) OS specific, also produce something that is fully Obsidian compatible? Maybe something likesafe_name:obsidian
?Example below
Version (please complete the following information):
Describe the bug Using
safe_name
filter still produces a name which is not valid as title (file name) in Obsidian, e.g. includes#
in file nameTo reproduce Steps to reproduce the behavior:
Obsidian October 2024 — Critique your plugin #1!
(https://www.youtube.com/watch?v=g2_XEDoPF4s)#
(in this case)As an example, I'm using:
{{schema:@VideoObject:uploadDate|date:"YYYY-MM-DD"}} VIDEO {{schema:@VideoObject:author}} - {{schema:@VideoObject:name|safe_name}}
Which results in something like this in Obsidian (in this case, the
#
should not be included?)Expected behavior A "safe name" that should be able to be used in Obsidian, without any possible issues (based on the name)
Workaround Using replace filter, e.g.
{{schema:@VideoObject:uploadDate|date:"YYYY-MM-DD"}} VIDEO {{schema:@VideoObject:author}} - {{schema:@VideoObject:name|safe_name|replace:"\#":"","\!":""|trim}}
Your template file