Code Block Macro on Insert Menu?

Our Confluence Wiki (4.0) has a lot of source code examples,

Is there:

  • A shortcut to insert a Code Block Macro (in the absence of markup)?
  • A way to get the Code Block Macro on the Insert menu when editing?

So at the moment I have to choose Insert | Other Macros | Formatting | Code Block

I'm hoping for something faster/easier

1 answer

1 accepted

5 votes
Accepted answer
David Simpson Community Champion Oct 19, 2011
Doesn't the auto complete help you? I just type {code then hit enter. It seems to work better than using my mouse to achieve the same task.

Ah, I see the problem.

As a long time confluence user I'm used to typing the {code} macro with brackets.

If I type slowly enough, the auto complete catches up and inserts the new graphical block thing.

Not a fan.

Is there any way to set the defaults for a code block (i.e. we're always using the same language, same theme).

David Simpson Community Champion Oct 19, 2011

I've not noticed a lag problem with the auto complete, but have heard from others on Atlassian Answers that it can be slow. I must admit that I'd like it to just insert a code block when I type {code} or {code:lang=html}, but that's not the current behaviour. I'm sure they'll catch up and improve the editor a lot in subsequent releases :P

Joe Clark Atlassian Team Oct 20, 2011

You can configure the default language and theme in the plugin's administration page: http://confluence/admin/plugins/newcode/configure.action

Although this is an old thread, I still did not find any solution like what David supposed... is there something?

Background: I type quickly, and inbetween I often need to insert code snippets of several code types. It is essential to have the possibility to set the code type by typing, not via mouse - with the mouse it needs actually too much time.

That is extremely annoying, and hence I hope, that maybe I just overlooked the needed feature?

Okay, got it myself, was just too much confused by the auto complete popup - typing "{code:language=bash}" did it f.e., and "{code:lang=bash}" seemingly, too (but in the latter case it is not preset in the edit formular). Before I had always typed "{code:language=bash<Enter>". That was the error. Closing the input with '}' opens the code box like expected.

It's a bit verbose, but it works for me.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in New to Confluence

How to use Confluence Cloud for stakeholder management

Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...

1,187 views 4 6
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