Login  Register

Inline roles inside blocks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options Options
Embed post
Permalink
mbc
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Inline roles inside blocks

mbc
Hi all!
I need your help!

I need to format a word (color text), but this text exists inside a listing block. For example:

[source]
----
> run mycommand

this is my [red]output
----

What I want to get is the word "output" colored in red.

I don't know how to "escape" the role in this case (included in the listing block).

How can I do that?

Thanks in advance!
mbc
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Inline roles inside blocks

mbc
(In my previous example, I forgot adding the  # character before and after the word to be formatted.)

I reply myself to solve the question: I must add the [subs="quotes"] attribute.

For example,

[source, subs="quotes"]
----
> run mycommand

this is my [red]#output#
----

Now, the "output" word is red colored.
msc
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Inline roles inside blocks

msc
In reply to this post by mbc

On Feb 20, 2019, at 1:49, mbc [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Hi all!
I need your help!

I need to format a word (color text), but this text exists inside a listing block. For example:

[source]
----
> run mycommand

this is my [red]output
----

What I want to get is the word "output" colored in red.

I don't know how to "escape" the role in this case (included in the listing block).



You need

[source,subs="+quotes,+attributes,+replacements”]
----
this is my [.red]#output#
----

You might not need all the subs. +attributes is the key. I think I have replacements because I am using some &foo; character entities in my listing block. And I might be using the ## construct because I have multiple words. [.red]output might work. I think I have [.red] rather than [red] because I am using a user defined role.

Regards

    -Mark