It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to control the formatting for code blocks

I am using Confluence Cloud, and inserting a code block to a document.

The language selected is CSharp.

 

When i save the document, there's no color highlighting applied to the code block, defeating the whole purpose of adding it as a code block:

codeblock.pngIs there any option to control how the code is formatted (color highlighting schemes) ?

2 answers

Hi @Lior Tal 

That is because you are using the new confluence editor. Yes it sucks and completely defeats having Syntax highlighting.

The old editor works perfectly:

csharp 1.pngCsharp2.png

I would suggest trying some other syntax's because it does work, perhaps just not for csharp. 

-Mike

i thought the new editor should be better than the old one ....

Hi @Lior Tal 

Most things they got right, the code block they failed miserably.

-Mike

Sadly, I have not yet been able to find a language for which the highlighting does work..

Hi @Lior Tal 

C++ offers some basic highlighting, so does R. 

code block c++.png

-Mike

As Mike said, it's an issue with the new editor. Technically they actually replaced the old 'Code Block'-macro with the 'Code Snippet'-macro. I don't really know why either.. There are a few feature requests open to give this macro better functionality, mainly this one. It doesn't seem to address this issue in particular, but to at least be a step in the right direction.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

Convert your old pages to the new editor

Hey Community 👋, Following the recent release of the new editor, we will be releasing the ability for users to convert existing pages from the legacy editor to the new editor. We’ve been resp...

4,624 views 32 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you