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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How do I paste code in comments and maintain indentation?

I'm at my wits end with this. Its not just Jira, but code snippets are generally terrible replacements in HTML based windows. I get how HTML playsd with whitespace, but I feel like this has all gone back to the dark ages as far as development goes.

I just want to paste code in to a ticket comments, whether it is with the code snippet short cut button "<>" and maintain a few tabbed indentations.

Other tools like MS Teams implement this, in equally bad ways where the code is unreadable.


I'm not expecting an IDE, but the atrocious manner for code in comment mark up is stunning.

2 answers

I share OP's frustration. I'm trying to copy in a chunk (20 lines) of space-indented JSON into a Jira ticket comment. No matter how I paste it, not only are indenting spaces removed, line-ends are removed, wrapping all lines of the JSON into a single line.


I have tried: 

  • `code` blocks
  • `preformatted` blocks
  • `preformatted` style
  • Manually typing some space-indented code before pasting, as suggested in another thread.
  • `Paste and match style`
  • I've pasted into a text editor (VSCode) and re-copied to clear formatting.

All fail identically. 

I'm using Chrome on a Mac.


I just tried pasting and re-copying to vi, and THIS WORKED! Formatting was preserved to the Jira comment. 

I then went back to VSCode and changed the Language Mode from JSON to Plain Text, copied the text, and this also successfully pasted into the Jira comment, with indents. 

So apparently VSCode is doing something "interesting" when copying code from a JSON-language editor. I repeated this experiment from Sublime editor in Plain Text and JSON language modes, and it always pasted correctly into Jira, preserving the indents and line feeds. 

I suspect many of the threads complaining of this problem, that get "not reproducible" responses are reflections of the application copying the text in the first place, not how Jira pastes the text. 


Go into Settings and search for `copyWithSyntaxHighlighting`, which is ON by default. Turn that crap OFF and resume a happy life. 

0 votes
Ivan Lima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 14, 2022

Hi @Stephen Wilson, welcome to the Atlassian Community.

I've been using the code snippet, and it works fine for me. It gets a bit messy if it's a large snippet, but I'd say it probably shouldn't be there if it's a large one.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events