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

How to capitalize text starting with ampersand in 4.x, eg: #tag #343

Open
Nantris opened this issue Jun 23, 2024 · 5 comments
Open

How to capitalize text starting with ampersand in 4.x, eg: #tag #343

Nantris opened this issue Jun 23, 2024 · 5 comments

Comments

@Nantris
Copy link

Nantris commented Jun 23, 2024

3.x used to handle this seamlessly. I tried a few configuration options to restore this behavior but I can't seem to make it work.

It's not the end of the world if we have to substring and reconstruct the string, but I'd rather not if I'm just overlooking something.

@blakeembrey
Copy link
Owner

blakeembrey commented Jun 23, 2024

Just to clarify, you mean starting with # right? An ampersand is &. And this was intentional in 2e0c64c. It could be added back as an option, but I'd love to hear about why you need to capitalize tags specifically?

If the goal is just capitalizing words, this is an expensive library for that and it's simpler to just do something like x.replace(/\p{L}+/ug, x => x[0].toUpperCase() + x.slice(1)) or something along these lines.

@Nantris
Copy link
Author

Nantris commented Jun 23, 2024

First, thanks for the great work and for your reply! Thanks also for the correction!

We use title-case to title-case a variety of user-generated titles on the local page, with hashtags being a subset of titles more broadly. While it's a bit heavy for hashtags, it takes a cognitive load off to keep the processing uniform and idiomatic.

@blakeembrey
Copy link
Owner

Sounds good. If we can get a rough idea of how you think it should work it shouldn’t be an issue to add an option for you. Is it just the same behavior in v3? I don’t have time to test right now, but I think it wouldn’t have capitalized anything that had a capital (same behavior as words today). E.g. it’d stay as #soGreat. Is that the right behavior? And on URL-like things, such as www.example.com, you’d want that to stay as-is right? So only affect #?

@Nantris
Copy link
Author

Nantris commented Jun 23, 2024

Yes I think all of your thoughts on how it should work align with mine (which I believe is how v3 worked as well - which indeed would preserve the existing capitalization of #soGreat)

Thank you again for your great work and your attention on this!

@Nantris
Copy link
Author

Nantris commented Jul 16, 2024

@blakeembrey sorry to be a bother with this. Is our best bet for the short-term downgrading? Might this be resolved in the next few weeks?

I'm trying to square away some final tasks before a new release and I'm wondering if downgrading should be one of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants