Inline code blocks

Hi there!

I am desperately trying to write some inline code within my documentation. In StackOverflow and GitHub I would do `my code`. For code blocks I do ```my code``` which also does not work (but I can work with the code macro). Something like that:

image2016-9-19 22:51:21.png

So how can I do that? Thank you for your support.

6 answers

This has been and continues to be a serious weakness of Confluence and Hipchat.

Confluence is used heavy by software teams. Software teams speak in sentences mixed with code. Forcing us to use code blocks that break the flow of a sentence is a really poor flow.

Slack gets this 100% right. I can type:

We should really consider using `const toolpane =` instead of using `var toolpane =` when we don't expect the variable to change

That should just work. Meaning it will auto-format my inline code snippets. It works on Slack. It works on Github. It is high-time it works on Confluence as well. 

Anything less is just a bad experience. I haven't met a single person yet who disagrees with that.

I could NOT agree more with you Blake.

Confluence is almost certainly 90% used by code teams, but it's code documentation capabilities are not just bad, they are "WORST IN CLASS"

Hey Atlassian, while I'm on a rant.

The {code} macro.. It just grinds at me each and every time I use it. I can happily edit that inline, but then I just have to grab the mouse, and click the title, click edit, wait (I swear.. 5 seconds.. GEEZE!!), then find syntax highlighting, click the fucking dropdown, find my code.. and click that, and finally I"m fucking done!!

Holy shit - I'm seriously just pissed off THINKING ABOUT HOW PAINFUL THIS IS!

Throw me a bone here--- make this thing have the ability to pick a code block WITH highlighting all from the keyboard.

Peter DeWitt Community Champion Sep 24, 2017

Ed I feel your pain.  Why not open an support request for Confluence with the change you want to see.  That way it can be tracked and voted up by everyone else.

1 vote

I think you may have answered your own question - use the "code" macro.  Use braces to avoid having to use the mouse to pick stuff.

But that's not inline - am I missing something?

I think I might be, what do you mean by "inline"?

I select the code in a sentence and make it Monospace.

I mean something like this example from StackOverflow:

image2016-9-19 22:51:21.png

I also monospace it like Matt does.

To be clear, start typing your paragraph, then when you want to put in some code, type two open curly braces—the code—and two close curly braces, then continue typing the rest of the text:

I.e. Text {{code}} text

Result: Here comes some code 10 PRINT "Hello" and there is goes.

To get the gray highlight, à la StackOverflow, wrap the code in the Highlight macro:

image2016-9-20 16:9:37.png

image2016-9-20 16:11:43.png

There are so many escaping bugs with double curly braces that they are really unreliable to use in practice...

Have you tried putting the Code Block macro within a span macro?

Nope, I don't know how to do that. Searched for "span" in macros and couldn't find it. I'm using Confluence in German though.

It's part of the free Content Formatting for Confluence macros from Adaptavist.

Macros are slow and they break the flow of a sentence. I should be able to mix code into a sentence. Github and Slack support this. Why can't Atlassian support it as well? It's simply the way developers write now. 

It's a major product gap imho.

Please comment on these tickets for these issues to get Atlassian to fix this sh!t.

Inline code blockshttps://jira.atlassian.com/browse/CONFCLOUD-57638

Macros modal takes 5-6 seconds to loadhttps://jira.atlassian.com/browse/CONFCLOUD-57639

0 vote

Wrap inline code blocks in {{double curly braces}}, works for me.

It doesn't work for me in Confluence Cloud. If I write {{double curly braces}} It will show without any format. 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,896 views 27 12
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