Usage:
We want to do replacements in the selected text, for instance, the string
Menu >> submenu >> command
should be transformed into
Menu » submenu » command
Additionally we could add some markup to display the text in italic (or wrap a layout span around it). Example for such a smart fragment:
<i>%replaceText(">>","»",selection)%</i>
Ideally the text (html) should still be selected after the replacement operation, this way we could concatenate multiple such commands for some powerful formatting.