Documentation for Confluence 5.5.
Documentation for Confluence Cloud and earlier versions of Confluence is available too.

Skip to end of metadata
Go to start of metadata

The Code Block macro allows you to display source code in your document with the appropriate syntax highlighting. The code block displays on the page as shown below:

Using the Code Block Macro

To add the Code Block macro to a page:

  1. In the Confluence editor, choose Insert > Other Macros.
  2. Find and select the required macro.

Speeding up macro entry with autocomplete: Type { and the beginning of the macro name, to see a list of suggested macros. Details are in Using Autocomplete.

To edit an existing macro: Click the macro placeholder and choose Edit. A macro dialog window will open, where you can edit the parameters of the macro.

You type the code block directly into the macro placeholder in the editor. Note that any white space contained in the placeholder is not manipulated in any way by the Code Block macro. This is to provide the writer with flexibility over code indentation.

Parameters

Parameters are options that you can set to control the content or format of the macro output. Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).

Parameter

Default

Description

Syntax highlighting
(language

java

Specifies the language (or environment) for syntax highlighting. The default language is Java but you can choose from one of the following languages/environments:

  • actionscript3
  • bash
  • csharp (C#)
  • coldfusion
  • cpp (C++)
  • css
  • delphi
  • diff
  • erlang
  • groovy
  • html/xml
  • java
  • javafx
  • javascript
  • none (no syntax highlighting)
  • perl
  • php
  • powershell
  • python
  • ruby
  • scala
  • sql
  • vb

Title

none

Adds a title to the code block. If specified, the title will be displayed in a header row at the top of the code block.

Collapsible
(collapse

false

If selected, the code macro's content will be collapsed upon visiting or refreshing the Confluence page. Clicking the expand source link allows you to view this content. If false, the code macro's content is always displayed in full.

Show line numbers
(linenumbers)

false

If selected, line numbers will be shown to the left of the lines of code.

First line number
(firstline

1

When Show line numbers is selected, this value defines the number of the first line of code.

Theme

Default

Specifies the colour scheme used for displaying your code block. Many of these themes are based on the default colour schemes of popular integrated development environments (IDEs). The default theme is Confluence (also known as Default), which is typically black and coloured text on a blank background. However, you can also choose from one of the following other popular themes:

  • DJango
  • Emacs
  • FadeToGrey
  • Midnight
  • RDark
  • Eclipse
  • Confluence

Configuring the Code Block macro

You can configure the Code Block macro to use a specific language and theme by default and also upload new lanuages. You need Confluence Administrator permissions to change the default theme and language and System Administrator permissions to upload new languages.

To set the default appearance of code blocks in your site:

  1. Choose the cog icon , then choose General Configuration under Confluence Administration.
  2. Choose Configure Code Macro.
  3. Select a Default Theme and Default Language.
  4. Choose Save.

All new code blocks will use the default theme and language unless you specify otherwise. Existing code blocks will be unchanged. 

 To add an additional language:

  1. Choose the cog icon , then choose General Configuration under Confluence Administration.
  2. Choose Configure Code Macro.
  3. Choose Add a new language
  4. Locate your language file and enter a Name for the new language (this will appear when selecting the language).
  5. Choose Add.

Language files must be correctly formatted JavaScript files and adhere to the Custom Brush syntax. You can find some examples of language files here.

To disable or remove a user-installed language:

  1. Choose the cog icon , then choose General Configuration under Confluence Administration.
  2. Choose Manage Add-ons.
  3. Go to User-installed Add-ons and locate the add-on for your uploaded language - it will appear like this 'Custom Code Macro Highlighting for...'
  4. Choose Uninstall or Disable

The language will no longer appear in the Code Macro. 

Code examples

The following examples are provided for advanced users who want to inspect or edit the underlying markup for a Confluence page. 

Macro name: code

Macro body: Accepts plain text.

Storage format example

The following example shows all parameters and a body:

Below are three examples of the Code Block macro with various optional parameters used.

Description

MarkupWhat you will get
Code block macro with a body and no optional parameters
Code block macro with a body and the optional language parameter defined

Code block macro with a body and optional title, line numbers and language parameters defined

This is my title

Wiki markup example

 

 

106 Comments

  1. While neither list bash or jython, you may wish to check out the http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro and http://confluence.atlassian.com/display/CONFEXT/Pygments+Code+Macro plugins which support a wider range of languages and have a more pluggable interface for new languages.

  2. Anonymous

    Why is there a scroll bar on the right hand side of the code block that doesn't even slide? Whenever I create a code block it makes a scroll bar that is just the size of the block! Thanks

    1. Hi,

      Did you meant to say that you would like to control the scrollbar display in the Code Block macro? If that is the case, there is an improvement request being raised at the follwoing:

      If you are keen on this improvement, please do cast your vote to increase its popularity and add yourself as a watcher for future updates. Also, feel free to add comments to reflect the importance of this improvement.

      Regards,
      Choy Li

    2. Anonymous

      try height and width parameters |height=50%|width=100%

  3. Anonymous

    Hi I noticed that python comments in the code block have python keywords highlighted (when they shouldn't) .

    1. The Code Block Macro does not support Python out-of-the-box. The default formatting will fall to Java, hence some Java keywords in the Python script may be highlighted where it shouldn't. You can use {code:none}...{code} if you want to avoid the highlighting.

  4. Anonymous

    Is there a way to define a line in the code block to be emphasized after syntax-highlighting?

    Often there is a need to point the reader to exactly one line in the source code (e.g. that must inserted or is the clue in the code) but not missing syntax highlighting for the rest. In LaTeX there is a parameter for this in the code macro.

    1. Hi,

      As far as I know, this feature is not currently available in Confluence. However, I have found similar feature requests:

      Please add yourself as a watcher, vote for this feature and add your own comments to this feature request. For further details on how we include new features and improvements, you might want to read this page.

      Anyway, as a quick workaround, you could accomplish this by using a user macro trick. In order to create a new user macro:

      1. Go to Dashboard > Administration > User Macros
      2. Click Create a User Macro.
      3. Name your user macro anything that you want. eg: boldcode
      4. Tick "Macro has a body" and Use unprocessed macro body
      5. Change Output to "Macro generates HTML markup"
      6. In the Template, copy and paste the following:

      Once you are done with that, you can simply use this macro anywhere in your page by specifying the following in your wiki markup:

      By specifying this, the line that starts with '^' and ends with '$' will be bolded. However, there is a limitation with this approach. It can be used only one time in a {code} macro

      I hope that would be a good start for you. Feel free to change the code to suit your needs.

      Cheers
      JSashi

      1. It has almost been a year since anybody commented on http://jira.atlassian.com/browse/CONF-1179 and only 4 votes. I think Altassian documentation itself would benefit in being able to highlight areas of code to readers.

        Any chance this could be expediated despite the low votes or do I have to campaign for it?

        Thanks,

        Tin

  5. How can I have the code block macro opitmized, so that it's shown with different background colors for each line?

    Mine always look boring :(

    1. You might want to try the New Code Macro which provides an improved UI.

      Cheers,
      Mark

  6. We want to use the code macro (or something like it) to document how to configure our system.  Two specific things that would help a lot are being able to use boldface and italics within the code block.  For example, if I say

    You can set the "foobaric" parameter on the "gronk" object like this:

    I'd really like the string "value" to be in italics. Is there any way to do this?

    --JMike

    1. Hi Mike,

      Currently the {code} macro's purpose is to disable all formatting which will be pretty useful in some case. However, I do understand that sometimes it's important to be able to highlight some text within the {code} macro. I have actually created a user macro that allows you to do this. In order to create a new user macro:

      1. Go to Dashboard > Administration > User Macros
      2. Click Create a User Macro.
      3. Name your user macro anything that you want. eg: formatcode
      4. Tick "Macro has a body" and Use unprocessed macro body
      5. Change Output to "Macro generates HTML markup"
      6. In the Template, copy and paste the following:
      7. Once you are done with that, you can simply use this macro anywhere in your page by specifying the following in your wiki markup:

      The first parameter in the {formatcode} is to specify the first position where the text should be formatted and the second parameter will indicate the last character position. The last parameter signifies the format. You can select any HTML text formatting here. For example: i,b,u

      Hope this helps.

      Cheers
      JSashi

  7. Anonymous

    Is it possible to make a wiki link insdie a code block ?

    For example, I would love to do something link

    1. Hi,

      There's currently no direct way of doing this. However, by modifying my code above, I managed to come up with the following:

      The instructions for creating the user macro is same as above. In order to use this user macro, just type the following:

      The first parameter in the {mycode} is to specify the first position where the link should appear and the second parameter will indicate the last character position. The other two parameters are for the link (url) itself and the alias.

      Hope this helps.

      Cheers
      JSashi

  8. Anonymous

    All I see is a swirly line under "What you will get". Why is that???

    1. You probably have JavaScript disabled in your browser. Enable it, and you should see the code content with appropriate highlighting.

  9. Our developers prefer to have the code macro wrap rather than scroll. It is possible to edit the CSS to easily achieve this by putting in something like the following in the custom CSS:

    The downside of this is that it does not update the line numbers to reflect the wrapping. Is there a way to do this or is there a simpler way to achieve what I want without having to edit the CSS?

  10. Hi!
    Is there is any way to customize text inside ? E.g. make some parts bold, to highlight them? Or make manually coloring for formats you don't support? For example you can create "custom" highlighting type where tag {color} will work. I want e.g. something like that:

  11. Anonymous

    the code macro in my experimenting displays tabs as 4 spaces in the viewer, but in the editor, displays them as 8 spaces. This needs to be configurable, both in the view (as a system preference, and maybe a code block option), and in the editor (as a personal preference)

  12. Hi~

    Hangul(Korean language) in code block seem to be broken..

    input) 한글

    1. Hi,

      we have the same problem with russian language.
      This problem occurs with "Java" Syntax highlighting (Syntax highlighting by default).
      But Russian works properly with another Syntax highlighting, for example "Cpp"

      So we just change the default "Syntax highlighting".

      Anna.

  13. I'd like to change the default "Syntax highlighting" and "Theme" values.  Is there someway to do this?  I'm comfortable hacking files if I need to.

    Thanks,
    Eric

    1. You can edit the defaults in the Confluence administration section:

      • Menu Browse --> Confluence Admin
      • Configuration --> Plugins --> Manage Existing
      • Click on Show System Plugins
      • Click on Code Macro Plugin --> Configure
      • Now you can change the defaults
  14. Anonymous

    I've noticed that if i put a URL containing "http://" in an XML code block, the entire string disappears. For example, in a panel I'll put

    <test-property>http://www.google.com</test-property>

    And the same contents in a code block configured with xml as the language gives me

    Anyone else seen this?

    1. Yes, I've faced this strange behavior too, I've reported it in JIRA: https://jira.atlassian.com/browse/CONF-23378

  15. Anonymous

    hi i have made a task list with drop down options but once the page is refreshed they go back to blank, any ideas?

  16. Anonymous

    Is there any way that I can highlight my code inside of the code block?  I would like to make some of the lines red or green, any suggestions?

  17. Anonymous

    When I paste code into the Code block, the indent level is removed.  

    Try copy/pasting this:

    When I paste this into a Code block, I get this:

    Before version 4.0, I always edited the actual macros manually. Can't do this anymore, and the new Code Block widget makes copy/pasting blocks with indent levels impossible. Or maybe I'm missing something?

    Thanks

    1. Anonymous

      I have the same problem. Using google chrome or internet explorer as the browser doesn't make a difference.

      I've tried indent with: tabs, spaces, nonbreakable spaces (alt+0160) and normal space followed by nbsp, followed by normal, followed by nbsp, etc., none of these work.

       

      Kind regards, Ray

    2. Anonymous

      I also encountered this problem. It is however not limited to the code block, but appears to be a issue with the new editor itself.

      One possible workaround, which works for me, is to Insert->Wiki Markup macro, paste the code in there, pre- and suffix it with {code} and add the (pre-4.0) wiki markup macro commands (syntax highlighting, line numbers etc) or just insert it as is, click on the code block edit button and change it there.

      1. Anonymous

        Thanks for the workaround!  I was really not looking forward to having to retype all the code (including every single space, since the tab key doesn't insert a tab) in order to get the correct indentation.

        This seems like a MAJOR bug in the code block macro editor to me.  Without the workaround, it would be next to useless for anything more than a line or two of code.  Do any developers at Atlassian use Confluence internally?  If so, I can't imagine they wouldn't have fixed this.

        1. Anonymous

          I created a bug issue, please vote for it here: https://jira.atlassian.com/browse/CONF-23833

  18. I don't understand why tabs are being removed, this is a very basic feature of a code-block i think. The structure of code is only with the supported syntax highlighting and the tabs.

    Thanks for any answers or suggestions

    1. Anonymous

      This has been quite annoying in confluence, also the new code editor breaks some config files we used to save as code blocks, since it always adds a space when you add a new line. I wish this would get fixed already, raw code inside code blocks should not be formatted in any way when added/changed/saved. When adding the code through the insert wiki markup plugin it works as expected, however modifying it after is impossible without another copy paste, this is hurting productivity a lot.

  19. Anonymous

    Huge problem for me also. Is there a place I can vote for a fix?

    1. Anonymous

      I created a bug issue, please vote for it here: https://jira.atlassian.com/browse/CONF-23833

  20. The removal of tabs when pasting code blocks is a major issue!  The "Insert Wiki Markup" workaround does work (thanks!), but it's extremely cumbersome since we have to delete the existing code block and re-insert it.  This really needs to be fixed ASAP.

  21. Anonymous

    I have the same Problem. I need the tab in my code. Fix it please!

  22. Anonymous

    This is not annoying!!!  I have tried to use the "Insert Wiki Markup" workaround as described above but this macro doesn't seem to be available for me.  Do I have to install this macro?  Is this a plugin that I need to download?

  23. I think I have figured out a workaround for the indentation; instead of creating a code macro and pasting the code in it (did not work), I created a wiki markup (Insert>>Wiki Markup), and added {code} to it, pasted my indented snippet, and voila - it worked. Created that way, you can later edit it with the Code edit dialog, choose syntax coloring style etc.

     

    ETA: I see now after reading all the comments, that this is a known workaround already!

  24. Hello,

     Maintaining source code on our wiki by hand has become a burden. Instead of copy and pasting source code, I want to link to the source files from our version control system. These are available over http behind our firewall. 

    Does anyone know a way to do that AND still provide code syntax highlighting? (The iframe macro will include the source file, but does not appear to permit syntax highlighting.)

    Many thanks,

    Ed

  25. Even the Insert Wiki markup and pasting indented code into the code block doesn't work for me!! The indentation is immediately removed and I have to manually indent.

    What I don't understand is why it says in Jira that this issue was resolved! I'm working in 4.1

  26. Hello, I am writing a length document with many code block marcos, for some reason half way through the page, border styling stops. As anyone encountered issue like this? or is there a way around to get to know which content is causing this.

     

    1. Spent quite a bit of time removing parts and pasting it back and checking if it appears correctly and finally managed to find the culprit. Only if confluence had tool to validate the content before saving could have saved lot of time.

  27. Anonymous

    I want the same thing that Ed is looking for - the ability to use the Code formatting macro - but point the source to a URL (JIRA fisheye url representing the HEAD/raw source for a particular file)

    Has this been done - or is it possible?

     

  28. Hi,

    We're a Jira/Confluence customer, and we're also a 100% Smalltalk shop. We're starting to have plenty of pages with Smalltalk code snippets, so we desperately want these snippets to be properly syntax highlighted. What voodoo is necessary to get Smalltalk syntax highlighting?

  29. Anonymous

    How would I put in custom syntax highlighting for my programming languange? 

    1. Anonymous

      A very strong plus 1 for being able to add own syntax highlighting definitions, or being able to import definitions from Vi etc.

      This can not be a unusual requirement considering so many other editors allow you to do this.

  30. Anonymous

    Can't paste text in on Safari?

  31. I want to add a link inside the code block. The link is to another page in the confluence space. But the code macro does not render links. Is there a fix or a workaround for this please?

     

  32. Anonymous

    "I don't understand why tabs are being removed, this is a very basic feature of a code-block i think." I quadruple this.  I can't paste into a code block w/o tabs being removed.  This is basic functionality and was reported months ago....

  33. When using the code macro there is a tool-tip with the hint "double-click to select code" which works as it says however the text that is copied to clipboard that way doesn't have "normal" spaces, causing problems for instance in shell executions or shell scripts.

    Selecting text only by dragging produces a different output, copying exactly the text that was written.

    For example using the following code snipt for bash execution

    {code:language=bash|title=sample code snippet in bash (try to copy/paste it)}
    if [[ "bogus" == "check" ]]; then
        echo "not suppose to see this"
    else
        echo "you should see this".
    fi || echo "something is wrong"
    {code}
    
    sample code snippet in bash (try to copy/paste it)

    Try to select the first line till the last and copy, then past in a linux bash shell.
    Then try to select all by double clicking and do the same to see the difference.

    I guess there might be some bug being introduced when doing double-click that is causing this effect. This makes very error prone to create some documentation page with code spinets (well formatted and indented) that users can copy/paste directly from it depending on "how" they select the text.

    I'm using Google Chrome.

    1. Further testing with other browsers I've noticed different behaviors:

      • Both Chrome and Opera behave similarly (work well with lines selection but not with double-click)
      • IE 8 works well with double click, but lines selection puts everything in one line (newlines are simply removed)
      • Firefox works well in either case
    2. I logged a bug about this, because it's really annoying (I use double click to 'select by word'). Please vote!

      CONF-28223 - Allow to disable the 'Hint: double-click to select code' 'feature' Open

  34. Anonymous

    When I try to export a page containing a code block to pdf/word. The code block isn't exported and instead an error message is shown:

    Error rendering macro 'code' : org/lobobrowser/html/gui/HtmlPanel

    Is there any way to fix this problem, since it it useful to use the codeblock in combination with the export feature

    1. Anonymous

      I have the same issue (Confluence 4.1). Any solution available?

    2. Obviously I'm having the same issue as you guys. Sorry I did not saw this post before asking my question (below).
      I guess that your still waiting on a solution too. (sad) 

  35. We need a code snippet that uses a macro to expand into a variable bit of text, but the \{code\} block stops macros from functioning inside it. Is there any way to get around this, a "pre-process this text" directive within a code block?

    For example, in the block below, we want to use redhat_url as a variable which will change from release to release.

    I'm open to different ways to do this, if a macro isn't the best way. I'd appreciate and tips. Thanks!

     

  36. Anonymous

    Is there a way to make the code macro stop using non-breaking spaces for indenting?  When I copy out of there and into SQL Server Management Studio Query Analyzer, that program thinks the non-breaking spaces are invalid and won't run the query.

    Maybe it's more of a bug in that product, I did open a ticket with them.

    1. Currently it seems to depend on which browser are you using and which copy/past method. See my post above.

      1. Thanks, i didn't realize it was only related to the doubleclick action....I can work around that for now.

  37. Is it planned to support syntax highlighting for D?

  38. Anonymous

    There seems to be an issue with language being overwritten when I Edit an existing Code Block.  Is there a way to edit Code Blocks without deleting the language setting (for syntax highlighting)?  I have tried everything I think of, but I can see no way to modify an existing Code Block without wiping the language.  It would be great if a field for language could at least be added to the Edit view.

    1. Not sure I fully understand the problem... Do you mean when the code block was inserted with a language that isn't in the dropdown list of languages you see when you edit the macro?

  39. Anonymous

    Its not possible to apply different themes to code blocks on the same page?

    By design or a bug?

  40. Anonymous

    Any chance we could get Objective-C syntax highlighting sometime soon?  Pretty please? (smile)

  41. Anonymous

    Any chance of better C++ syntax highlighting?  Currently Confluence seems to highlight keywords in one color, comments in another, and leaves everything else black.  How about something Emacs-like where I get one color each for method names, variables, types, comments, namespaces, and everything else?  I'd be even happier if you made the syntax highlighting customizeable so I could add some of these features myself.

  42. It would be nice if the wiki parameter names where added to the table as well. After all the visual editor is not availabel in JIRA, FISHEYE etc. pp.

    1. Hi Martin, these are documented here.

  43. Anonymous

    Hi, I'm a TA and have been asked to put XML code blocks in our Confluence (we have IE 9). Ran into the same problem of loosing formatting. In the end the quickest,easiest way I found was to use Notepad:

    a) right click on the XML file and open with Notepad ...(this seems to work and maintain formatting unlike using copy/paste directly from IE)

    b) from Notepad EDIT > SELECT ALL

    c) from Notepad EDIT > COPY

    d) in Confluence, create a new entry using the CODE MACRO and select the format (HTML/XML in my case) and SAVE

    e) Place the cursor in the resulting code field on your page and from the IE toolbar select EDIT > PASTE ...(this seems to make a difference to just right-click mouse and paste)

    If I tried copy paste in IE then the formatting was lost.

  44. Like many other people, I would like a way to highlight some parts of the text in the Code Block to catch the eyes of the reader.

    A user macro would be fine but I still cannot find one that fits that need.

     

    1. Hi Pierre, in case you haven't seen it yet, there's a feature request for this. You might like to vote on and watch it - CONF-1571 - Ability to highlight "changed" part of {code} Open

      1. Thanks. I voted on it. In my case, I'm not just looking at a way to highlight some lines of the code block but be able to highlight easily a few discrete lines/words (and not having to give lines number in the block parameters :-/ ).

        As I see it in my case a yellow/green/red/cyan background color would be the best way to bring user attention but anything else would be OK too.

  45. Hi guys,

    Does anyone know how to add a new theme to the Code Block Macro? I've become quite fond of the colours and fonts used in Google's Android documentation i.e. http://developer.android.com/training/basics/activity-lifecycle/starting.html#launching-activity

    Cheers

  46. It would be great to be able to distinguish some parts of code. What do you think? Simple highlight background color would be enough.

  47. When doing and "Export to PDF" from the Tools dropdown menu in the page I get the following error message instead of the content wrapped within the Code Block Macro.

    Error rendering macro 'code' : org/lobobrowser/html/gui/HtmlPanel


    At first I thought that I had some plugins to update so I made sure that everything is up to date. But I still get this error message on EVERY browsers, from both my Mac OS X 10.6 and Windows XP sp3 computers, so it gat to be something missing from our server's set-up. Right ?

  48. Would you be willing to add Verilog and VHDL support to the Code Snippet widget? It would be extremely helpful for us (and anybody else who builds hardware) to have syntax highlighting for those languages.

    1. Hallo Michael

      I've added a request to our issue tracker: CONF-28735 - Add Verilog and VHDL support to the Code Block macro Resolved

      If you like, you can watch and/or vote for the issue.

      Cheers, Sarah

  49. Does anyone know how to adjust the default tab spacing in the macro? Currently it's set to 4 and we would like to set it to 3.

    thanks,

    I did notice within the Jar file it has a file called shCore.js that contains the tab info but when I change that and save it back to the jar, an re-upload. It does not change the tab size.

     

     

  50. Could it be a caching issues after I made the change in the macro?

    How to Clear Confluence Plugins Cache

     

  51. The expand function works well...but why could one NOT collapse it again without reloading the page???

    Does someone knows if there is already a feature request (bug) which requests this collaps/expand toggle function?

  52. I am using the code macro to embed config files to confluence pages. so far so good. sometimes the config files are rather long and it would be good to collapse the parts of the config which is not relevant for the moment.

    is this something that maybe part of the macro sometime?

     

    Thanks

  53. SyntaxHighlighter brush for emails which will highlight mail threads with different colours.

    Create a file shBrushEmail.js and upload to Confluence with Confluence Admin -> Configure Code Macro.

    shBrushEmail.js
  54. I'm working on a document with lots of HTML code. There are two chunks of code near the bottom of the document that are placed in  code blocks. These two display properly in the page inside their boxes. However, any new code chunks will display, but without their box.

    Has anyone got any explanation for this? Any solution?

    Thanks

  55. Anonymous

    An example code block is breaking the page on save

     

    1. I'm not sure I understand what it might be in this code sample that's breaking the page...

      Thanks,

  56. Anonymous

    Is there an option that makes the code macro appear inline instead of in a snippet?

    I want to be able to write small piece of code inside a regular statement, not in a dedicated box.

  57. Anonymous

    Support for R code would be nice...

  58. Anonymous

    Is there a neat way to specify optional parameters within a code block, any particular formatting that would help beautify the output?

    1. Hi, you might want to ask your question at Answers - users from the community may have suggestions for how you can further customise this macro, or perhaps create a user macro to achieve the results you are looking for. 

  59. Anonymous

    In our organisation, each user will have preferred defaults based upon their role. Rather than set one default for all users, It would be very useful if the defaults could be set on a per user basis. Additionally, it would be useful if this did not require admin rights, since not all our users have this right.

  60. Anonymous

    no Lua highlighting? how so?

  61. I like the most recent changes to the code block, but now it never wraps. This causes some issues with the appearance of the content on the page. Is there an option to make it wrap and still count line numbers correctly?

    1. Hi Mark, there is an issue about wrapping and line numbers in the code macro here  CONF-23565 - Line wrapping throws off line numbering in code block macro Resolved . Feel free to comment or vote. 

  62. Anonymous

    Collapsible feature for code blocks is nice but would be better if the user can collapse the block after expanding it without have to reload the page.

    1. Yes, this would be VERY helpful!!!

    2. The latest version of the code block macro (at least in 5.1.2) now has this functionality. When you expand the source, a bar remains at the top of the code block with a link that allows you to collapse it without reloading the page.

  63. Anonymous

    It'd be great with syntax highlighting for Windows batch files.

  64. Anonymous

    Why aren't you using Markdown, this is a bit rediculous

  65.  To add an additional language:

    1. Choose the cog icon at top right of the screen, then choose Confluence Admin.
    2. Choose Configure Code Macro.
    3. Choose Add a new language
    4. Locate your language file and enter a Name for the new language (this will appear when selecting the language).
    5. Choose Add.

     

    Is it possible to add additional languages (specifically lua) in Confluence 4.3?

    1. Hi Jeremy,  as far as I'm aware it is not possible to add additional languages in Confluence 4.3.  You can download later versions of the code block macro plugin  from the marketplace, but the later versions (that include this functionality) only appear to be compatible with Confluence 5 and later.  Sorry. 

  66. Is this macro actually supported for 5.4.2? It comes up on our list of problem-add-ons for upgrading, and its documentation states that it is functional only through 5.3.4, but the top of this page says "Documentation for Confluence 5.4." Can someone please confirm that the most updated version of this add-on plays well with 5.4.2? Thank you!

    1. This add-on is bundled with Confluence, and is still supported in 5.4.2.    I'll investigate why it is coming up in the add-on check, it may be that the version on marketplace is listed incorrectly. 

      UPDATE: this has been updated in Marketplace now - so should no longer show incorrectly in the upgrade check. 

  67. Is there a way to provide multiple related blocks that will be rendered as alternatives to one another by showing say a tab selector or a drop down menu to pick which snippet you'd like displayed?

     

    This is especially useful in case providing same code in different languages but wihtou taking space on screen for all of them, showing only one at a time.

    1. Hi Roberto, there's nothing in the Code block macro to do that I'm afraid.  The only thing I can think of off the top of my head is to use the expand macro, and place your code block macro within it.