Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop code snippets from rendering

Deleted user July 18, 2013

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
Kirstin Seidel-Gebert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2013

Hi Kathleen,

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

Cheers,
Kirstin

Deleted user July 21, 2013

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
TAGS
AUG Leaders

Atlassian Community Events