Line strikeout help

Hello community,
I humbly ask for your assistance.

I’ve built a Shortcut I thought would auto add Ulysses’ strikeout Markdown XL (||) formatting to the start and end of each line of a selection of text.

I managed to get the loop and text replacement to work based on Quick Look results, but the pesky text selection doesn’t get replaced within the app.

Can anyone offer ideas on what I’ve left off or done wrong in the shortcut?

Thanks for your help and time.

I’ve modified your shortcut a little bit and commented the changes. I hope it helps:

Thanks @schl3ck.

Your approach is cleaner and more efficient.

The way I intend to use the shortcut is by selecting one or more lines of text in a text editor and running the shortcut to replace the original selection. Your’s and my attempt doesn’t replace the original selected text. Any idea how to clear out the text and insert the shortcut result?

You’re welcome!

To use the generated text, you have to copy it to the clipboard in shortcuts and then manually paste it, replacing the selected text. There is sadly no other way currently.

I understand. Seems like a significant limitation in Shortcuts. Perhaps iOS13 will add the ability to overwrite.