cheat-sheets icon indicating copy to clipboard operation
cheat-sheets copied to clipboard

Formatting characters lead to lost text

Open DougTidwell opened this issue 6 years ago • 2 comments

I discovered that the asciidoc markdown [_registry/username/_]_container_ confuses the parser. In this case I don't want the right brace in the middle to be italicized. [registry/username/]container is what I want to see. The fact that there's no space in the middle seems to be causing the problem. The parser ends up deleting [_registry/username/_] altogether. The only thing you'd see from this markdown is container.

DougTidwell avatar Mar 27 '19 19:03 DougTidwell

This looks a bit messy, but it gets things done:

{startsb}+++<i>registry/username/</i>+++{endsb}+++<i>container</i>+++

This is using a passthrough. You can find more information about passthrough blocks at https://asciidoctor.org/docs/user-manual/#pass-macros

LightGuard avatar Mar 27 '19 23:03 LightGuard

I've found a better way:

\[pass:q[_registry/username/_]]_container_

This uses less weird syntax, is eaiser to read and also uses standard syntax, so we're not explicitly passing html to the backend.

What we're doing here is escaping the first bracket which stops asciidoctor from thinking it's a link or block, using an inline passthrough block to get the italics, then everything else as you would expect.

LightGuard avatar Mar 27 '19 23:03 LightGuard