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

Preserve whitespaces when pasting monospace formatted text

Jörg von Frantzius October 19, 2014

Hi,

I would like to paste some text preformatted with whitespaces, within which I want to highlight parts as bold.

I cannot highlight parts of the text within \{noformat} or \{code} sections, and when I paste the text as normal text then the whitespaces get lost upon pasting. This also happens when pasting within a paragraph that is formatted as monospaced.

How can I paste monospaced text while both retaining whitespaces and being able to highlight individual words within it afterwards?

8 answers

4 votes
AndyAtTogether February 18, 2015

I think Jorg's point is that he would like to paste some text formatted with whitespace. when you do this normally all your whitespace gets removed, which is really annoying!

one option is to paste your text in as wiki text, this preserves the whitespace but removes any other formatting which is equally annoying.

any recommendations on how to solve this?

svdwijdeven January 30, 2020

For those looking for a workaround:

  • copy & paste into text editor (like Notepad++)

  • find and replace ' ' (space) with '\xA0' (use regex option)

  • copy & paste text into Confluence

It's something...

Like # people like this
Sam Kendall February 29, 2020

Good suggestion, @svdwijdeven. One can search the web to figure out how to type non-breaking space into one's favorite editor. In emacs, it's C-x 8 SPC.

Peter Olsen February 24, 2021

The find and replace on spaces did not work for me. Confluence just displays all the supposed to be hidden text. 

Example:

\xA0\xA0\xA0\xA0:file_folder:\xA0Competition\xA0and\xA0Teaming
\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0:file_folder:\xA0VTP\xA0Completed

ALSO Confluence is not recognizing the ":file_folder:" icons either.

1 vote
Judy Loomis March 30, 2021

I just wasted 1/2 an hour doing something that should be just control-V and done.

This is nonsensical that you strip spaces from preformatted text.

I have had many frustrations with your formatting, but this one is just dumb.

Peter Olsen March 30, 2021

I agree!

Andris Zeila April 2, 2021

I can explain it only that Atlassian themselves doesn't use confluence internally, or they would have fixed this bullshit years ago.

Not sure what to think about company that does not use product they are developing.

1 vote
matskm March 17, 2021

Adding my +1 to this: Atlassian please sort out this basic editor deficiency.

I've just wasted far too long trying to figure out a workaround to pasting in a very long (indented) json file which I want to section up with "Expand" blocks where the whitespace is kept intact.

So many of your users are developers, and we "read" indentation as a basic way of communicating.

And I can't use the "code" macro for this: I want to colour code the text, and add comments on individual lines.

As mentioned above, I also want to expand and contract different parts of the file.

All this would be possible with one simple improvement: keep the leading whitespace on pasted text.  

1 vote
Chuck Alley September 25, 2020

Why do we need workarounds and hacks?  What has Atlassian been doing for the last 6 years?  I have been a computer professional since 1983.  In any given 6 year period companies have come and gone.  Developed whole suites of apps and they screwed the pooch and gone out of business.  I came to Confluence in 2017 from Sharepoint.  Has Atlassian significantly improved the Confluence editing environment since 2014?  I ran into this problem in the first week of using Confluence, cutting and pasting code, regression results, and other text to status documents I maintained for team reference.  I doubt this is an uncommon activity.  

1 vote
flancer64 September 1, 2020

I have the same problem with version 7.7.2. My suggestion is to use browser's dev tools and paste formatted code directly into `<pre>...</pre>` element. I use https://www.online-toolz.com/tools/text-html-entities-convertor.php to convert html special chars:

Screenshot at 2020-09-02 09-34-18.png

jason_s April 6, 2021

This seems to work.

Or use a Markdown WYSIWYG editor, paste the text there, then grab the <pre> output and paste into Confluence.

1 vote
Darren Reed April 26, 2020

To insert code that is correctly formatted you need to use the "Insert" (+) button on the top of the page and select "... Other macros". From there enter in "code" in the search area and select "Code Block". This will apply syntax highlighting to suit the type of code you are inserting (a selection of languages is available from this dialogue.)

If you just want to insert regular text, such as the output from a command such as "df", then choose "Plain Text".

Chuck Alley June 1, 2020

This works only if you don't want to do any formatting of the text in the code box.  But if you want to go back add bold or anything really, the code stubbornly stays "preformatted".   If you try to change the formatting back to "paragraph" it strips the formatting again.

This is, what you call BS, Atlassian.

0 votes
Pedro Galan September 24, 2020

Here is my workaround: Screen Recording 2020-09-24 at 8.28.54 PM.gif

John Gallucci October 20, 2020

This lately has been my go-to choice for hacks and workarounds when the UI has failed me (which is increasing with every product release)

jason_s April 6, 2021

:cries: We don't have the Source Editor plugin.

Anyone know if there's a JIRA issue in Atlassian's bug database filed for this insane bug?

Judy Loomis August 20, 2021

I'm afraid they somehow think it's a feature. Someone clearly doesn't understand the word "preformatted"

0 votes
Guilherme Nedel [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 26, 2014

Hello Jörg, the functioning of the noformat and code macros is intended to strip the content within from any special formatting which includes font styling and text indentation, this behavior is the expected. In case you would like to highlight text within, you may use characters such as * asterisc or the # pound sign.

 

Deleted user August 28, 2018

@Guilherme Nedel  'this behavior is the expected'...  No offense to you but I believe this to be a poor choice on Atlassian's part.  Many of my colleagues use the terminal as their primary source of data to exchange with other managers within Jira.  I often want to copy and paste data extracted from a tools output in the terminal into a jira ticket.  The stripping of spaces is annoying and I agree with @davejohncole that Atlassian should realize this.

Like # people like this
Brian Barbe July 22, 2019

Agreed. As a means of communicating with developers, I often copy/paste from my terminal output into JIRA or Confluence. Preserving whitespace is a must when I'm copying ascii tables from a script output.

Spaces should not be stripped out when copying into a preformatted block. That's the whole point of it being preformatted...

Like # people like this
Trevor Seitz October 24, 2019

I would love to know what use case dictates that white space be removed from a copied block of preformatted text. It might help me be more understanding of this otherwise poor understanding of how your product is used.

Like # people like this
Brad Spilde October 28, 2019

Worst document editor possible for writing a technical manual or guide. You can't even change the tab or paragraph options after you put content into the page.

Any document editor of any type should allow for the original format of the copied text to retain its formatting with simple spaces or tabs.

Like Pasi_Miettinen likes this
kyle keppler November 20, 2019

Please correct this and do no remove whitespace.

Like # people like this
Ryan Rawdon January 21, 2020

@Guilherme Nedel is there a bug or feature request that has been submitted for this?  If not, what is the process for one being submitted and accepted?  

Sergio Mucino April 15, 2020

I'm with everyone on this one. We use Confluence for our internal documentation, and I need to often include sections of Python code. The fact that I cannot copy and paste it without losing all the spaces is extremely annoying. And I can see this is a complaint since 2014. Wow.

Like jason_s likes this
Sergio Mucino April 21, 2020

FWIW, and for anyone who finds this discussion... I just discovered that if I copy my code from Visual Studio Code, the formatting is preserved when I paste it into Confluence. Don't know about other IDEs, but worth knowing.

jason_s April 6, 2021

Is there a JIRA issue filed against this bug? Because it is a bug to remove spaces.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events