How to control the formatting for code blocks

Lior Tal January 15, 2020

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) ?

3 answers

2 votes
Dara January 16, 2020

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.

0 votes
Mauro Asprea
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!
May 6, 2020

I am having this exact issue with the "code block". The syntax is highlighted on the macro panel, but it is not highlighted when I "save" the comment/post. See below:

Screenshot 2020-05-06 at 10.51.03.pngScreenshot 2020-05-06 at 10.50.46.png

 

The "collapsible" also is not working on the content neither (it does on the macro block).

0 votes
Mike Bowen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2020

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

Lior Tal January 15, 2020

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

Mike Bowen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2020

Hi @Lior Tal 

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

-Mike

Like pierre deneuville likes this
Dara January 16, 2020

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

Mike Bowen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2020

Hi @Lior Tal 

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

code block c++.png

-Mike

Lee August 25, 2020

Code Snippet is an absolute train-wreck.  For a company so heavily focused on software development tools to have thrown away syntax highlighting and configurable line numbering as part of their "Improvements" to their documentation offering is unconscionable.

Code Snippet is just <pre> with line numbers.  Big whoop. 

Like Nelson Caballero-Olave likes this
Jason Koppel
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!
July 1, 2021

Is there a way to pull up the old code editor still?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events