Splitting a Code Block

eli
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!
August 25, 2024

I wrote a lengthy code block and was wondering if there is a simple way to "split" it where I want.
For example, place the cursor/mouse half way down and press.... (?) and the code block would split into two code blocks.

1 answer

1 vote
Kristian Klima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 25, 2024

Hi @eli and welcome to the community.

There might be an app in the marketplace with that feature, there are many that specialize in offering a better code macro experience.

Within the Confluence tooling, you can't do that.

Having said that, you can use two Expand macros and place a code bloc with 1/2 of the code in each.

Simply name your Expands like 'code sample part 1' and 'code sample part 2' to achieve the similar effect.

Sure, you need to split the code manually but you'll also make the page more palatable.

 

I use this trick when I have two or more code samples doing the same thing for different languages. So my expands are called like Java, Python, C++ etc. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events