Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Escaping user input (including {code}) inside {code} block

Sean Williams
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 26, 2024

Hi folks,

I'm making a Jira API client that posts issues from our monitoring services. I'm trying to (correctly) present forwarded data inside a {code} block, without said data breaking rendering in Jira.

My first thought was to simply replace { and } with backslash-escaped variants of themselves, but this causes the backslashes to present to the user.

I tried making a code-block whose contents were the literal string {code} in the Visual editor inside Jira, and saving the page caused two empty code-blocks to appear. My assumption is that Jira is not actually doing any escaping here, so it sees three {code} blocks and processes it as the start/end of a first block, then the start of a second one.

Is there a "correct" way to do this? Did I have the misfortune of uncovering a rendering bug in Jira's markup?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events