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

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?

7 answers

The fact that you cannot paste text into a performatted section without effluence stripping whitespace is embarrassing.

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 Jernej_Gosar likes 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.

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.

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.

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.

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

0 votes

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)

0 votes

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.  

Suggest an answer

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

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

415 views 23 8
Join discussion

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