Code macro is ignoring spacing for single line examples.

I'm trying to write a line by line breakdown of a function in Python, similar in design to the following:

codedefinition
def foo(bar):
We define the function foo to take input and store it in bar.
print(bar+"!")
Then we print bar and append an exclamation point.

However, the indented line examples (in this case print(bar + "!")), lose the two leading spaces (as seen in my example above). Is there any way to stop the removal of those? I want to maintain Python's syntax between cells, without having to completely recopy the code each time.

1 answer

While horribly manual and inconvenient, you can use divs to style the text and add unicode spaces for indents:

image2017-3-22 20:0:54.png

Add Div macro and in the Styles field, put

font-family: monospace

Then wherever you want the spacing, copy the space between these brackets, ] [, and add that to the front of the text as many times as you need. Then color and bold the text using the regular Confluence Edit toolbar.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,798 views 26 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you