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

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

Preserve whitespaces when pasting monospace formatted text

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

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?

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

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.

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.

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".

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.

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

This seems to work.

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

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.  

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

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.

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.

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.

 

@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

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

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

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

Please correct this and do no remove whitespace.

Like # people like this

@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?  

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

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.

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

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

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)

: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?

Suggest an answer

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

🏑 Atlympic Event: Confluence

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

569 views 19 17
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