Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I highlight code in Confluence Cloud

Pat D'Ambrosio
Contributor
June 8, 2018

Hi!

We have highlighted pieces of code in yellow, but I can't seem to find out how to replicate this inside the codeblock macro.

For example: security validation

security needs to have a background of yellow, while the following word and all surrounding text does not.

Thanks!

2 answers

0 votes
Dennis Fu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 15, 2025

...I answered to a wrong question but don't know how to delete this answer

0 votes
tdoran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2018

What I would suggest is that if you use the "Preformatted" style for the code that you ut in the confluence page, you should be able to use the "annotations" on that text. 

Then you will be able to get the Highlighting to work.  

Pat D'Ambrosio
Contributor
June 8, 2018

The preformatted style does not allow proper indentation.  To get this we need the code block and a bit of wrangling... Arghh! Where are the annotations that would highlight this text to be found? I see that the Annotations plug-in is no longer available.

tdoran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2018

When you view a page, you should be able to highlight a piece of text and a popup will show, that will allow you to start an annotation. Click the chat icon and that will highlight the code, and you can start talking about it.

Screen Shot 2018-06-08 at 12.10.42 PM.png

Pat D'Ambrosio
Contributor
June 8, 2018

TY Tony, buOnt I am not talking about entering comments for review.

I am stating this: 

I have a piece of code in my code block.

One/more words/lines need to be highlighted in yellow for the user.

?: Can I do this/not in Confluence?

BTW: I don't want to talk about it, I just want to show it ;)

tdoran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2018

Just to be clear when you add that annotation it will highlight that text as yellow on the page.  

But to answer your question directly: 

"I have a piece of code in my code block.

One/more words/lines need to be highlighted in yellow for the user.

?"

 

No. Not with that code block macro.  Wanted to offer you a potential alternative.

Pat D'Ambrosio
Contributor
June 8, 2018

TY, but not good. We don't want annotations showing up for our end users do we??

Where we need the yellow highlighting is in the code block, which honesltly takes far too many steps to get properly formatted and requires tools outside of Confluence.

Can Confluence consider this for a feature improvement or as a bug?

tdoran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2018

I added it in right place, so it can be triaged. 

https://jira.atlassian.com/browse/CLOUD-10573

Pat D'Ambrosio
Contributor
June 8, 2018

Wow! I am impressed.

I have a number of other requests that would make Doc output much better. Can we chat?

Pat D'Ambrosio
Contributor
June 11, 2018

Tony, 

I had an issue Friday night viewing this and now see that I lack permissions??

Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events