How do I format a {} as inline-code?

When writing or commenting on a ticket or documentation in either JIRA or Confluence, I often highlight variable names or values with the inline-code markers (which is two open curly-braces, text, two closed curly-braces).

{{$foo}}

Now something that comes up regularly is the construct {}, which I just had to make italic instead of inline-code, because I don't understand how to escape it properly to make it show up.

I have tried a variety of things, including backslashes and spaces at various places. In the following I'll use a markdown-like syntax to show which part is highlighted. Things in backticks `$foo` are turning up inside the highlighted area in the rendered JIRA output.

{{{}}}     # {`}`
{{ {} }}   # {{ {} }}
{{\{\}}}   # {`}`
{{\{}}}    # {`}`
{{{\}}}    # {{    (that one is my favourite)
           # {\}}
           # }
{{{{}}}}   # {`}`
{{{}}{{}}} # `}{`

This is highly weird. And very frustrating. This thing is relevant to JavaScript, JSON data and various other programming languages.

How do I make that thing highlighted correctly?

4 answers

This widget could not be displayed.

If you don't need it inline, you can use {noformat}, but you probably know this.

This widget could not be displayed.

Yes. Or {code}. But I want to be able to say something like "By default, this method will return {{]}}", but with an empty object, not an empty array.

This widget could not be displayed.

My solution was to separate the }}} with soft hyphens (https://en.wikipedia.org/wiki/Soft_hyphen).

 

That way, You can do something like this:

{{{ \}­}} # returns { }, code formatted. There is a soft hyphen character between the first and second }.

I'm guessing this comes much too late for Julien, but hopefully any future people seeing this will find this useful.

This widget could not be displayed.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

99 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you