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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How do I paste code into Code Block with preserved indentation?

In the past, when I pasted indented source code into a Code Block, it preserved the indentation.

Now, whenever I paste any source code, any leading spaces are removed, no matter how I paste - Paste as Plain Text or pure Paste.

How to fix?

1 answer

1 accepted

0 votes
Answer accepted
Diego Atlassian Team Sep 08, 2020

Hello @Jiri Pik !

As I understand, the Code Block macro is not respecting the indentation after copying code and then pasting it inside the macro.

I tried it first in our Cloud Platform with the new editor (Fabric). It behaved as expected. Here is what the original code looks like:

Screen Shot 2020-09-08 at 16.55.23.png

 

Here is what the code looks in Confluence in edit mode:

Screen Shot 2020-09-08 at 16.56.49.png

 

And in View Mode:

Screen Shot 2020-09-08 at 16.57.03.png

 

Now, I did the setup of a Confluence Server version 7.6.1 and the results were the correct ones too:

Edit Mode

Screen Shot 2020-09-08 at 16.55.33.png

View Mode

Screen Shot 2020-09-08 at 16.55.52.png

With these results, I would like to ask you a few questions:

  1. What version of Confluence are you using?
  2. Is this happening regardless of the browser being used?
  3. Would it be possible for you to share screenshots of a “dummy” code as an example?

 

Keep in mind that our community is an open space and everyone can see everything posted here. So take extra care not to disclose any sensitive information within the screenshots.

 

Let us hear from you!

Hello:

Check this https://www.screencast.com/t/wirC0mJvE6

The server is Confluence 7.7.3. It actually did work until a month or two ago.

The problem does exhibit itself in Chrome and Edge.

Like Diego likes this
Diego Atlassian Team Sep 18, 2020

Hello there @Jiri Pik !

I was able to replicate this behavior consistently in both Confluence 7.7.2 and 7.7.3. Here is the bug report I filed:

The best course of action would be to vote and watch the report. The only workaround I found was to manually indent the code.

Let us hear from you!

Like Jiri Pik likes this
Like Diego likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

82 views 0 3
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