Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Making the code block collapsible in the v2 editor

Is there a way to make the code block collapsible in the v2 editor? i can't find an option for it, and it needs to be collapsible, since the json im putting in there is 6000 lines long

14 answers

1 accepted

1 vote
Answer accepted

Hello Mat,

Thank you for bringing this up. It's not yet possible while we roll about the new editor, but we have a feature request below that would include that:

  • CONFCLOUD-66437 Allow further customization of the "Code" macro in the new editor

Please vote on the feature request and you will be automatically added to the list of watchers.

As a workaround, you might want to attach the code in a text file with a preview snippet using the code block macro.

Let me know if you have any further questions about that.



@Shannon Spaniol Hi there -- it looks like I can no longer insert the Code block macro in confluence pages....and thus cannot make this true?

Hi Colin,

Welcome to Atlassian Community! It's nice to meet you.

The Code macro has replaced the original Code Block macro. The Code Block Macro was the one that has the ability to collapse, the Code macro does not.

The feature request I shared with Mat earlier would hopefully include a collapsible option for the new Code macro.

Can you confirm that you're able to insert the Code macro using the slash / command in the new editor?



This should not be classified as feature suggestion, it should be a bug because it is very frustrating to use the editor v2 when it lacks in such a trivial functionality like collapsibility and this was preset in v1.

Like # people like this

Hi Alexandra,

Thank you for following-up on this thread. I agree that the Code macro is definitely lacking in comparison to the Code Block macro.

However, the Code macro is a different macro entirely, thus the feature request for the missing capabilities that were offered in the former Code Block macro. 

There are multiple other missing features in the new version of the editor, so if you encounter anything else you find that is sorely lacking, you can compare with our Confluence Cloud Editor Roadmap to see if it's a feature we plan to include in the future.

Take care,


Like Alexandra Mihaltan likes this

As a workaround for a shitty new editor, I've put a code block inside an "Expand" element.

Like # people like this
They still have code blocks in the comments though!

But they don't expand...

Like # people like this
Like # people like this

Doesn't even let me to put the code snippet inside the expand block :facepalm:

@Darina Voloshyna may I ask if you managed to solve this issue? As I have faced the same now :( cannot add  code  inside  expand block

It is working only if it is not inside the table or other element. Just the expand block in a root of the document, and code block inside of it. But doing so inside the table won’t work :(

Like # people like this

Thanks for prompt response @Darina Voloshyna !

P.S.: that's a pity to hear though (((

Not being able to remove line numbers makes my table of functions look horrible

Like # people like this

Just adding my voice... collapsible code blocks were really useful... kept a page legible... people see a huge long page.. they dont read... if they dont read they give up and dont learn.

Needs to go in.. seriously needs to go in 



Checking in August; any updates on this yet?

Checking in October 2020, any updates on this yet?

The question is:

  • how do we make a code block collapsible in the new editor?

Update? No Atlassian doesn't appear to care. The only solution I am aware of is to put a code macro inside an expand macro.

Like # people like this

And why was this "Solved"? They still haven't fixed anything.

Like # people like this

Why Atlassian take it away?  That's stoopid.

Like # people like this

It is bad to remove a good feature when upgrading something

OMG - it keeps getting worse.  Formerly I used the code in an expand block workaround, now this does not work in tables.

Way to drive it into the ground, Atlassian!

+1 They have managed to remove the most useful feature...

And marked the feature request as solved :(

Like # people like this

The same, doesn't work in tables, when trying to put code block into expand block.

Atlassian remove existing functionality as part of upgrade.  Users request to fix, results in a feature "suggestion".  2 years later they are still considering it.

Fireman lights a house on fire.  The occupant calls to the fireman for help.  Fireman commences thinking about what should happen next...

In case it isn't clear, we are the occupants of the house that is on fire.  Atlassian, are you even listening any more?

Is the code block collapsable workaround? why did they mark it as solved? It's frustrating!!!

This is a very good feature to have it removed

This is clearly a bug.  Any significant technical design requires large code blocks but without the collapse feature, the document becomes TL;DR  - this is a bad dog moment for atlassian :-(

I discovered if one has an older document that used the older code block macro, it is possible to copy that document and with it will be capability to include the older code block macro with the collapse feature.

Juli 2021 ... Still waiting for this.

Confluence / @Shannon Spaniol any news on that?

Hi Sebastian,

Thank you for your reply. I looked into the request, and as of April, there's an updated version of this request. This includes the requirement for collapsible code blocks. 

You can follow that here:

  • CONFCLOUD-72003 Allow further customization of the "Code" macro in the new editor (Different background color & ability to collapse the code block)

  Thank you again for your feedback, and take care.


Suggest an answer

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

🏑 Atlympic Event: Confluence

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

488 views 18 16
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