How to escape Replacements?

Hello. I am trying to escape a replacement command — !fig<$@> — so that it survives compilation unchanged.

I know that you can escape placeholder tags by placing a back-slash before the opening < symbol, and am looking for the equivalent for replacements. Thank you.

Usually backslash \ before the first character is all that is required.

Thank you for your response and help. Unfortunately, simply putting a backslash is having no effect in this instance. The commands are still being replaced during compilation.

The !fig part is a replacment not a placeholder, to you may have to look up the replacment and escape it as well.

Do you still need the actual replacements in other parts of the project? My only other suggestion is to use another unicode character, so e.g. !fıg<$@> (use latin dotless i). This shouldn’t get replaced but looks similar…

Did you try escaping more bits, e.g. !\fig<$@> or something?

Otherwise I can only suggest if you to use another temporary tag and use a script to edit the markdown after compile? For Scrivener the whole point of a replacement is to replace so it is obviously just doing its job well! :laughing:

Thank you both for your suggestions.

I am documenting how I have set up Scrivener + Pandoc (with all of its filters, custom templates, etc.) for my form of academic writing, in case I ever to have to set it up again. This includes a list of my replacements and how they work.

I have indeed tried all combinations of backlashes. If I place a backslash before the angle bracket < then it doesn’t get converted, but the backslash also passes through the Compile.

No worries. I will indeed just manually ‘post-process’ it in this instance. In any case, beyond this ‘project’, I can’t imagine a case in which I’ll ever have to escape a replacement again!

For the record, there is a solution for this after all.

What must be commented out are the symbols #, @ and $@ with a backslash before each.

e.g. <#page:$@>
e.g. <@page:$@>
e.g. !ar<id>

(Note that in the final example a backslash is also required before the < symbol.)

When the Scrivener project was Compiled, these escaped commands were not replaced. Thus, when next run through Pandoc, correct LaTeX, docx, and HTML files were all produced.