Home / GitHub Page

Tags - Lower Case Only?

I know this is minor but is there is a plan to allow upper case characters in tags? Some of the tags I now use are related to established acronyms, such as RFC and ISO, and these as well as other tags appearing as all lower-case just doesn’t look right. Is there some fundamental reason that Joplin converts all tags to lower-case? If not could this possibly be considered as an enhancement suggestion with any subsequent tag sorting / searching being case-insensitive?

I have searched the forum but the nearest related post I could find was from SEP18 but it was never answered. Of course this possibly suggests that this is not really that important for most people.

I am writing this as just a user. I am not a programmer so please don’t suggest that I submit a PR and have a go. I would love to have the skills to do so but sadly I don’t!!!

2 Likes

If the tags were case sensitive then you can easily create multiple tags on accident. For example, if I create a tag called Home for a note and later I create a tag called home for another note then they would actually be two different tags in the system.

This is just my thought on it. I don’t know if this is the actual reason or not.

@boring10

That could be a problem but I did not actually mention making tags case-sensitive but to,

allow upper case characters in tags

and

any subsequent tag sorting / searching being case-insensitive

So for your example only one entry would be permitted because,

home = Home = hOme = homE etc. etc.

Just like when creating a folder / file in Windows.

It’s quite common to only have lowercase tags so I think users are used to it. For example, on Stack Exchange or GitHub all tags are lowercase.

1 Like

@laurent

OK. Admittedly my suggestion was aesthetic rather than functional. Also it never gained much traction in the past.

I will take your comment as the opinion of the BDFL! :grinning:

I agree with the comments above, and respect the conclusion to allow lowercase tags only.

However, after importing over 500 tags from an old Evernote .enex file, all my tags are in proper case (e.g. “Tag”).

So it would appear that the case requirements around tags are not enforced upon import. (They are enforced once imported, as I can rename proper case tags to lowercase, but not the reverse.)

As someone else has ressurected this post I thought I would take the opportunity to say that although it is five months later I am still “not used to it” :slightly_smiling_face:

1 Like

If the reason to use case-insensitive tags is to avoid duplicates, wouldn’t it be better to have a check for that when creating new tags in the interface? This will be more transparent (you get what you type) and will allow the users to decide the format of the tags themselves.

Personally, lowercase proper nouns and abbreviations look ugly to me and complicate reading.

Right now, I am having both case-sensitive tags (imported) and case-insensitive, and they aren’t grouped properly in the tags sidebar.

2 Likes

As someone else has ressurected this post I thought I would take the opportunity to say that although it is nine months later I am still “not used to it” :wink:

2 Likes

I face the same problem when I test importing some notes from Evernote. Before I fully migrate Evernote to Joplin, I hope this Tag Capitalised case feature can be provided.

If they are people who prefer pure lower case, while some prefer Capitalised case, can we provide this as a option/preference in the setting?

1 Like

One way is to convert the label to a style similar to a-b, but currently joplin imports data in other formats without an intermediate layer (maybe I don't know?), so the intermediate layer cannot be processed. But you can use joplin rest api to process it, which should be very simple (traverse all tags and convert them to lowercase strings connected in other ways).

The sample code is as follows

; (async () => {
  const convertTagList = ['testValue']
  const tagList = (await tagApi.list()).filter(tag => convertTagList.some(name => name.toLocaleLowerCase() === tag.title))
  console.log(tagList)
  tagList.map(({ id, title }) => ({
    id,
    // convert operation
    title: title
  }))
  // update
  .forEach(tag => tagApi.update(tag))
})()

Thanks. Actually, I would like to have Capitalised case. Besides those imported from Evernote, I would like new tag created in Joplin to be Capitalised (if I create a new tag, eg. IoT). Is this something can be done via rest api?

Can't

the source code must have deliberately force a conversion to lower case when we create a tag. It must be not too difficult to NOT to force lower case conversion. Leave the case as what User key in.

As someone else has ressurected this post I thought I would take the opportunity to say that although it is eleven months later I am still "not used to it" :smiling_imp:

Tags have to be normalised somehow or else there has to be some tooling to allow the user to rename tags, merge them with others, etc. I'd be keen to support lowercase, uppercase but last I checked it was quite complicated to do so. Or if someone thinks it's an easy problem to solve the source code is there to be fixed :slight_smile:

Aren't tags assigned / manipulated using the id: of a type_: 5 record rather than the tag name itself? Admittedly sorting / searching would likely have to be made case-insensitive.

Also how do you merge tags?

Of course this is being said by a person who could only possibly "fix" the source code if there were an infinite number of me, an infinite number of computers and an infinite amount of time (and possibly still require help from the infinite number of monkeys who apparently write their plays this way) :grin:

Thanks for supportive to make this happen. I will take a look at the source code. See how complicated it is.

I have taken a quick scan of the source code. The following is what I find out.

The current tags (be it in lowercase or uppercase, for those imported from Evernote) can remain as-is in the database. Do not need to take any action. Thus, don't need any tooling to allow user to make any changes to their current tags.

If someone decide to take advantage of this change, to rename their current tags to uppercase (or capitalised format), the current tag rename function will work. Just need make changes to the source code not to force toLowerCase().

Let me know if my understanding is correct.

I will continue go through the source code in more detail. And maybe do some testing to verify that.