rednectar
rednectar

Reputation: 176

How can I change text colour mid word in asciidoc syntax?

I have the task of converting some documents to asciidoc format.

I have ONLY the asciidoc standard tools - I do NOT have access to any of the css sheets that asciidoctor uses to render my output.

I have a need to change colour of a word mid word.

Let's assume the word is RedNectar

I want the first three letters rendered in red, the last five in yellow

If I split the word and use [red]#Red# [yellow]#Nectar#

I get the right colours, but a space between them

enter image description here

But if I remove the space, [red]#Red#[yellow]#Nectar# it renders as:

enter image description here

[The yellow highlighting is simply the preview indicating a problem]

So what magic do I have to perform to get these two half-words to join? In many cases, I have the same problem between words as wee, when I use the {nbsp} (non-breaking space) between words - it's now seen as a space at all and I strike the same kind of problem as you can see here - I HAVE a space between Red and Nectar - it's just a {nbsp} - and STILL doesn't render properly.

enter image description here

Upvotes: 6

Views: 8503

Answers (1)

Richard Smith
Richard Smith

Reputation: 49692

Use an unconstrained formatting pair for the second formatted word:

 [.red]#Red#[.yellow]##Nectar##

Upvotes: 8

Related Questions