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

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?

6 answers

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.

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

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.

Is there still no easy-to-use solution for this?

There is now specific programming language support in code blocks. Specify the language in the leading code block as described in the Syntax guide.

 

Use {code: json} for example to handle those pesky curly braces when pasting json.

OP's issue is with inline code style, not code blocks.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

273 views 1 2
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