HTML replacements when compiling to EPUB?

I would like to use a RegEx replacement to convert special placeholders into tags in my EPUB. This almost works, but the < and > are converted into HTML entities. Is there any way to tell Scrivener to treat my replacement text as HTML?

For example…

Original text:

Replace:

:([A-Za-z0-9_]+):(.*)::

With:

<span class="\1">\2</span>

Expected result:

Actual result:

There is a way to do what you are looking to do, but at the moment there are two problems with implementing it. There is a bug in the feature itself, and for some reason we neglected to include it in the e-book outputs even though it should work just fine with them.

So, stay tuned for beta builds (it may be a month or so yet before one appears, we’re in the middle of some restructuring). Here is what you’re going to want to do: in the HTML Settings compile option pane there will be an option, “Treat ‘Preserve Formatting’ blocks as raw HTML”. This option can already be found in the regular HTML compile output, but you will find it doesn’t work well at the moment on account of that bug.

As you might expect, any text you enclose in [b]Format/Formatting/Preserve Formatting[/b] will not be processed for entities and turned into visible text. Placing the custom placeholder in this block will protect the placeholder and the text that eventually replaces it, passing it straight through to the HTML output.