'asciidoc: Is there a way to get around the problem of lines beginning with [colour] attributes ending with ] not displaying in asciidoc?

My target asciidoc text is this:

[red]#Some prompt[x]# Make sure the option is [checked]

But it won't display in asciidoc

On further investigation, I found that any line beginning with a [colour] in square brackets, and ending in a right-bracket is similarly not displayed.

Now, in this case, I've got around the problem by putting the whole prompt section in bold, like this:

*[red]#Some prompt[x]#* Make sure the option is [checked]

but this is not ideal. Adding a period after the final close bracket \] also AVOIDS the problem - but in my use case I didn't like it.

I'd like to know if there is a better way. So far I've tried:

  1. Escaping the leading open bracket \[
  2. Escaping the final close bracket \]
  3. Removing the [x] in the middle, thinging the additional brackets in the middle may influence the outcome

but none of these has worked.

So my question is:

Is there a way to get around the problem of lines beginning with [colour] attributes ending with ] not displaying in asciidoc?



Solution 1:[1]

It seems to me that a line which begins with an opening bracket and ends with a closing bracket is being interpreted as a block attribute line.

There are a number of ways you can mitigate this.


Use a character replacement attribute. There are many built-in attributes, or you can easily define your own.

For example:

[.red]#Some prompt[x]# Make sure the option is [checked{endsb}

Use one of the inline pass-through syntaxes, for example ++:

[.red]#Some prompt[x]# Make sure the option is [checked++]++

Prevent the first opening bracket from being the first character of the line. Also, uses a built-in attribute, and the markup needs to be changed to unconstrained.

For example:

{empty}[.red]##Some prompt[x]## Make sure the option is [checked]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1