It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

2 answers

1 accepted

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).

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.

This {code is not working in the latest version of JIRA

I just noticed this... 


I was uploading Markdown converted to HTML content via the Confluence REST API (during a Github Wiki Migration).

When using this method, I could have "Code Blocks".

On pages where I'm creating Pages form the Confluence UI, I have no such option.

I just get the generic non-themed text.


VVVV Created w/ Confluence UI

Screen Shot 2019-08-07 at 3.47.28 PM.png

Screen Shot 2019-08-07 at 3.47.46 PM.png




VVVV Uploaded via REST API...

Screen Shot 2019-08-07 at 3.57.48 PM.pngScreen Shot 2019-08-07 at 3.58.54 PM.pngScreen Shot 2019-08-07 at 3.57.25 PM.png



These seems completely wrong.

It works with / instead according to:

A single autocomplete shortcut: Type / to open a menu and add macros, tables, emojis, mentions and more to your page as you go.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

327 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you