stefanopagliari / bibnotes

359 stars 30 forks source link

[Feature request] support multi-word tags #167

Open SeveNOlogy7 opened 1 year ago

SeveNOlogy7 commented 1 year ago

Thanks for this AMAZING plugin!

It would be very helpful if this plugin can convert multi-word tags in Zoteto into Obsidian tags using the current #{{keyword}} syntax. For example, tag like 'Tag with space' should be converted to #Tag_with_space instead of #Tag with space.

It's very common that multiple words are used to name Zotero tags and collection, because Zotero support doing so. And because Obsidian only support tags without blank spaces, the current conversion of multi-word tag looks broken. image

I dig around the source and made this modification to makeTags function:

export const makeTags = (str: string) => "#" + str.replace(/\s+/g, '_');

And it works like: image

Looks better. Then I tried the comment tags (tags in {{PDFnote}}), and found that in the current version the in-tag spaces are removed before makeTags image

So the handling of Tags is not consistent in the plugin.

Suggestion

Before makeTags, format tag texts to remove/replace in-tag spaces according to a configurable format setting (choosing from camel case, snake case , etc.)

osmalpkoras commented 1 year ago

Can we just add support for string literals in tags? If you enclose the tag in quotes (like #"A tag with spaces"), you could allow for any character inside the string.

SeveNOlogy7 commented 1 year ago

Can we just add support for string literals in tags? If you enclose the tag in quotes (like #"A tag with spaces"), you could allow for any character inside the string.

I tried this but #"A tag with spaces" will not be rendered as a tag in Obsidian.