How to stop code snippets from rendering

This isn't really a question, it's a built-in answer. This post applies to Confluence 3.5 and earlier.

I've been using the wiki for a long time, and can't be bothered with the menu system* when I already 'know' what to do. So I use the wiki markup editor and type things such as:

{code}Some code snippet here{code}

Which is fine unless there's a curly bracket { within the code snippet. The wiki tries to render the code, interprets the { as the beginning of a macro, and spoils the example.

I've learned that if you stop acting like a power user and

  1. click the macro button on the toolbar
  2. find the Code Block macro
  3. paste your code snippet into the dialog box

It's all perfectly fine and doesn't attempt to render it. I'm told there's probably an event handler built into the dialog box that evaluates the pasted text, that isn't there if you use ordinary paste.

Moral: just because you've used something a long time doesn't mean you know it.
... And as they say in NLP, "if what you're doing isn't working, try something else".


* and also, it shows that Atlassian <rant:on> were on the path of forcing us down the path of "Use The Menus All The Time Because We Know What You REALLY Want" a long time ago. OK, I have used the 4x onward editor and it's no worse (and no better) than any other RTE editor, if that's what you want. But it will never replace the convenience and simplicity of wiki markup. </rant>

1 answer

1 accepted

0 votes
Answer accepted

Hi Kathleen,

can't you escape the "inner" curly bracket with a backslash?


Um yes. I just tried it and it did work on a very simple example on my second try. On the first try it displayed the escape \ character as well as the inner bracket.

Interestingly, I copied and pasted the whole example, removed the \ characters and now it displays the second example *without* the excape characters correctly without rendering.

But .... it's a lot of extra work to mark up what ought to be a simple copy & paste.

Also, I'm unconvinced that it will work on a complicated example with other characters (such as _underscores_ or -strikethrough- symbols).

So thank you for suggesting it. It does indeed sometimes work, but not without fiddling about with it.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

259 views 2 10
Read article

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