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

Hi Kathleen,

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

Cheers,
Kirstin

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

606 views 20 11
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