$SRC_ANCHOR in HTML and EPUB compiles

I just updated from Scrivener 2 to Scrivener 3, and I imported all my compile presets.

For my HTML and EPUB presets, all of my sections now have code like this near the top:


And to make matters worse, my heading font does not include curly braces, which wind up getting wrapped in span tags, like this:

<p class="p1"><span class="s1">{</span><span class="s2">$SCR_ANCHOR::doc1$END_SCR_ANCHOR</span><span class="s1">}</span><span class="s2">Hello, world!</span></p>

So fixing this with search/replace is no easy task.

If you compile with the built-in HTML and ePub formats, do you get the same results?

Slàinte mhòr.

Thanks for the response! I forgot to check the notify option, so I didn’t realize this thread had a reply.

I found a workaround for my HTML format: uncheck “Convert document links to HTML links” in compile Options (under the gear icon). I do have a TOC that links to each chapter, but the HTML version of my e-book doesn’t really need this feature, so it’s OK to uncheck this box.

Unfortunately this workaround does not work for my EPUB format, presumably because the compiler still needs to create anchor points for the EPUB’s built-in TOC.

The problem does seem to occur when the font being used at an anchor point does not happen to include curly braces in its character set. Would it be possible to change the temporary markup Scrivener creates for this particular feature to use a more common character, like a colon?



I’ve looked into this and it actually has nothing to do with fonts (which don’t affect the underlying text). The problem is that your RegEx replacements are interfering with the internal tags that Scrivener uses for anchors during the Compile progress, mangling them so that they are no longer recognised at the other end of the process. I’ve fixed this for the next update, but in the meantime you can work around it if it’s possible to tweak your RegEx replacements.

All the best,

Thanks for all your help!