Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shortcut for "code block" macro in Confluence editor

Tags:

confluence

We use confluence for documentaion but i find very time consuming to select the code macro; it's a 5 step process. Even typing the macro by hand is not efficient.

In the Stack Overflow editor all we have to do is select the text and press a button or hit ctrlK, and the text is formatted as code.

Is there a way to do this in Confluence?

like image 255
Mirage Avatar asked Nov 26 '12 02:11

Mirage


People also ask

How do I embed code in Confluence?

From the editor toolbar, choose Insert > Other Macros. Choose HTML from the Development category. Choose Insert. Paste the HTML embed code from the website you want to display into the body of the macro.

How do I highlight codes in Confluence?

When you view a page, you should be able to highlight a piece of text and a popup will show, that will allow you to start an annotation. Click the chat icon and that will highlight the code, and you can start talking about it.


2 Answers

even typing by hand is also not efficient

I use the code macro extensively and always use the autocomplete feature by typing { and choosing 'Code Macro' from the list (It's enough to type co for the code macro). This is a very efficient.

Of course a keyboard shortcut would be faster, but there is no shortcut for the code macro. (AFAIK there is no keyboard shortcut for a specific macro at all)

like image 152
jimmybondy Avatar answered Sep 22 '22 10:09

jimmybondy


I use Ctrl-Shift-D then wrap the text in {code}.

This also fixes the problem with formatting being stripped from pasted text. In Confluence 5.x if you edit a page, you can type {cod<enter} and it puts a Code Block box on the page, but when code is pasted into this box it can strip out end of line characters.

  1. Open the Insert Markup window using Ctrl-Shift-D
  2. Paste in your code as plain text
    This way the formatting is not stripped out.
  3. Add {code} tags.
like image 32
Underverse Avatar answered Sep 22 '22 10:09

Underverse