til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

How to escape curly brackets within code tags

When you describe RESTful endpoints, it can be useful to describe dynamic parameters embedded in the URL, like so:

https://service/{version}/customer/{customerid}

When you then want to communicate this in a Jira issue (User Story) or in the Confluence, you run into issues, since the curly brackets are reserved for macros - so we need to escape.

We use slash (‘\’) for this.

So the above example should be written as follows, escaped with slashes:

https://service/\{version\}/customer/\{customerid\}

The below example is is for a larger block, using the {code} macro for displaying for example JSON and then escaped for inclusion in Jira or Confluence.

{code}
\{
    "default": true,
    "MD004": \{ "style": "dash" \},
    "html": false,
    "line-length": false,
\}
{code}

Resources and References