Difficulty in consistently escaping __ markup

Posted by oddhack on
URL: https://discuss.asciidoctor.org/Difficulty-in-consistently-escaping-markup-tp5318.html

I want to write a sentence with multiple instances of an identifier whose name
starts with __ (two underscores). Test case:

__kernel foo __kernel foo __kernel
    -> (when entered as written, all examples using Asciidoctor.js browser plugin,
         pseudo-HTML markup to indicate italics):
kernel foo kernel foo __kernel

Not what I want, but that makes sense given the __ operator. So I should escape it:

\__kernel foo __kernel foo __kernel
    ->
__kernel foo __kernel foo __kernel

That's what I actually want. But I should escape all instances of the term for consistency, right?

\__kernel foo \__kernel foo \__kernel
    ->
__kernel foo \__kernel foo \__kernel

Oops. How about following http://asciidoctor.org/docs/asciidoc-writers-guide/ "Preventing substitution"
and using double backslash?

\\__kernel foo __kernel foo __kernel
    ->
\__kernel foo __kernel foo __kernel

Still oops. How about being consistent with \\?

\\__kernel__ foo \\__kernel foo \\__kernel
    ->
__kernel__ foo \__kernel foo \\__kernel

At this point I concluded that I have no actual understanding of how the \-escaping
rules work, or how to consistently write the term '__kernel' in a way that will render
properly, and not affect following syntax. Insights appreciated.

Thanks,
Jon