How can I keep leading spaces and formatting in text?

Kurt Fankhauser February 27, 2018

I want to show a code snippet in the description or comment of Jira AND I want to mark up certain lines with color AND preserve format (monospace with leading spaces).  For example, I want to show the following and color the third line text in red:

   <player instance="1">
    <description>Player device not configured</description>
    <hostAddress></hostAddress>
    <playerName>1063B</playerName>
    <defaultDirectory>/fs0/clip.dir</defaultDirectory>
    <driverFileName>libplayerapidevicedriver.so</driverFileName>
    <latency>0</latency>
   </player>
 

 {noformat} preserves the spacing and gives monospace, but I cannot apply {color:red} to the text.  Likewise with {code}.  How can I accomplish this?

1 answer

0 votes
Patrick Turley November 16, 2020

I do this by pasting the text into a {panel}, selecting it all, and formatting it as "monospace."

The one gotcha appears to be that leading spaces aren't displayed.  You can fix this by changing all leading spaces to "no-break" spaces.  There's no question that that's goofy -- it's up to you to decide if this is too goofy.

Kurt Fankhauser November 16, 2020

Although this may work, it involves too much hand editing.  I had really hoped Atlassian would provide a fix or a macro to help with this.

Suggest an answer

Log in or Sign up to answer