Managing code block width

GC September 2, 2018

I am trying to include a code block in a page while documenting some stuff. If i try to put a code block under a sub-section (i.e., not really to the left-most side), then even in that case, the code block is aligned to the left-most side as shown in the attachment. Is there a way (without getting Administrator involved) i can align it so it starts just under the sub-section?

Confluence - Code Block Alignment.png

2 answers

0 votes
Lars Vagt
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!
September 21, 2020

Maybe others still have the same question, although some time has gone.

In order to add the code block in continuation of your list item, you need to do this:

  1. Go to the end of the list item, the box shall belong to. In your above example, your cursor should be right after "... to application's directory:".
  2. Add a pure line break (Shift + Enter). In the above example, the cursor is on a new line beneath "Run" now, but there is no new item "b)".
  3. Add the code block macro, for instance typing "{code" and selecting it. The code block just starts where your cursor was before.

In order to continue the current item with more text, you can just click to the right of the code block, and make another line break (Shift + Enter).

If you wanted to add a new item, you would make a real paragraph break (Enter without Shift).

0 votes
Krisztian Kovacs
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.
September 3, 2018

Hi @GC,

I assume using a table would not be an elegant solution but that you could do? I mean it's just a quick and silly idea.

GC September 3, 2018

Hi @Krisztian Kovacs,

That's right. It doesn't look elegant :( and i have also tried aligning tables earlier for similar use-case where i wanted to create it under a sub-section. That too doesn't budge from its leftmost position.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events