Is there a way to slice content into multiple contents while keeping the click functionality?

I want to slice up [Helloworld] into sequence([Hello],[world]) I’m writing a plugin and my current approach is to use something like this:

for value in foo.text {
  result.push([#value])
}

which would slice the content up into individual character wide contents (or into two chunks, etc.). The issue I have with this is that taking the text string and reconverting it back to content seems to loose the location property and I want people to be able to click on the text and it brings them back to the original source where they wrote it. I thought about something like this:

#let test = [Helloworld]

#let split-example(body) = {
  {
    show "world": ""
    body
  }
  {
    show "Hello":""
    body
  }
}
#split-example(test)

this would effectively achieve the same result visually, but is kind of hacky and I wouldn’t want to do this on a larger scale.

It seems to me that this is the crux of your issue (you can already disassemble at least simple text into parts). Could you try to reflect that in your post’s title? Thanks!

Just save the initial content? The use case is pretty vague, I don’t understand it.

There is also context [#metadata(here())<label>].

text <text>

Linked
#context {
  let text = query(<text>).last()
  link(text.location(), text.text.clusters().join())
}

image

this would be a pdf document clickable link, while I wanted to keep the editor clicking functionality. So while link() does work for exported documents, it’s not what I was having issues with.

By editor you mean typst-ide’s jump from click? Which is used by the web app and Tinimyst preview thingy.