Attaching URL to an AttributedString

I’m currently working on a basic Markdown parser to be embedded within an application. From what I’ve gathered, the easiest way to do this will be to break up the input into a number of attributed strings containing the correct representation of what the formatted text should look like.

My question comes to, how would I go about creating a clickable link using an AttributedString? Currently the only method I can come up with is doing a hit-test and finding which string was clicked. Does anybody have any better ideas?

This is essentially what we do for URL clicking behavior. It’s a pain, but AFAIK it’s the best option in JUCE.

In case you run into this: underlining stopped working on for memory fonts on macOS recently: Underlining has stopped working for TextLayout / AttributedString