How to control the formatting for code blocks
Asked by Lior Tal:

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.png](/t5/image/serverpage/image-id/79028i04150B4AEC3D3273/image-size/large?v=v2&px=999 "codeblock.png")Is there any option to control how the code is formatted (color highlighting schemes) ?


Answers:
author: Dara
body: 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](https://jira.atlassian.com/browse/CONFCLOUD-66437?_ga=2.49192545.615837763.1579159754-1712400248.1568012946). It doesn't seem to address this issue in particular, but to at least be a step in the right direction.


author: Mauro Asprea
body: 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.png](https://community.atlassian.com/t5/image/serverpage/image-id/93639i6A94CC1CB4FB8D17/image-size/large?v=v2&px=999 "Screenshot 2020-05-06 at 10.51.03.png")![Screenshot 2020-05-06 at 10.50.46.png](https://community.atlassian.com/t5/image/serverpage/image-id/93640iA7E9A77CDEB5972A/image-size/large?v=v2&px=999 "Screenshot 2020-05-06 at 10.50.46.png")

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


author: Mike Bowen
body: Hi [@Lior Tal](/t5/user/viewprofilepage/user-id/1129532)

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.png](https://community.atlassian.com/t5/image/serverpage/image-id/79075i197AC4941C9A1883/image-size/large?v=v2&px=999 "csharp 1.png")![Csharp2.png](https://community.atlassian.com/t5/image/serverpage/image-id/79076i343382F06A1FCA9E/image-size/large?v=v2&px=999 "Csharp2.png")

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

-Mike

comments: author: Lior Tal
body: i thought the new editor should be better than the old one ....


author: Mike Bowen
body: Hi [@Lior Tal](/t5/user/viewprofilepage/user-id/1129532)

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

-Mike


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


author: Mike Bowen
body: Hi [@Lior Tal](/t5/user/viewprofilepage/user-id/1129532)

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

![code block c++.png](https://community.atlassian.com/t5/image/serverpage/image-id/79289i9CE42D24BD78FC76/image-size/large?v=v2&px=999 "code block c++.png")

-Mike


author: Lee
body: 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.


author: Jason Koppel
body: Is there a way to pull up the old code editor still?


Tags: atl-gruland

code

code-block

confluence-cloud

format