How to escape double plus plus sign "++" in Asciidoctor Asciidoc?
Asked Answered
G

2

6

For example, if I write:

Notepad++ is *great*, I like Notepad++

it treats ++something++ as an escape construct which ignores the * bold and produces:

<p>Notepad is *great*, I like Notepad</p>

instead of the desired:

<p>Notepad++ is <strong>great</strong>, I like Notepad++</p>

Upstream discussion: https://github.com/asciidoctor/asciidoctor/issues/1864

Tested on Asciidoctor 2.0.10.

Grape answered 16/9, 2020 at 9:43 Comment(0)
G
8

A few options that do what I want:

Notepadpass:[++] is *great*, I like Notepadpass:[++]

Notepad{blank}pass:[++] is *great*, I like Notepad{blank}pass:[++]

Notepad{plus}{plus} is *great*, I like Notepad{plus}{plus}

I'm not 100% sure if the Notepadpass:[++] is meant to work of just an accident. I think I'm just going with {plus}{plus}.

Where {plus} is documented at: https://asciidoctor.org/docs/user-manual/#charref-attributes

For the specific case of C++ there is also {cpp}.

Grape answered 16/9, 2020 at 9:43 Comment(0)
S
2

Another option is to use a backslash to escape the first ++:

Notepad\++ is *great*, I like Notepad++

This works in a similar way on other formatting as well.

Sutherlan answered 17/10, 2020 at 14:32 Comment(1)
Tested on Asciidoctor 2.0.11.Grape

© 2022 - 2024 — McMap. All rights reserved.