Support for Swift language syntax highlighting?

This question is in reference to Atlassian Documentation: Code Block Macro

Are there any plans to support Swift and Objective-C for proper syntax highlighting?

2 answers

This widget could not be displayed.
Stephen Deutsch Community Champion Feb 10, 2016

I see that your labels include that you are using Confluence Cloud.  You can add a new language file to Confluence Server very easily (by using a brush file for SyntaxHighlighter such as the one here: Clicking on Configure Code Macro under General Configuration shows a link to "Add a new language".

Unfortunately, Confluence Cloud doesn't appear to show the option to add a language.  You might be able to ask Atlassian Support if they can install it for you, but no promises smile

I can install the brush, but unfortunately i get an error that the brush is not found for swift. Reinstalling the brush did not work. Did you tried to install the brush in your Confluence?Bildschirmfoto 2016-03-11 um 23.28.14.png

I've fixed it.

First letter of Brush alias has to be capitalized.

Brush.aliases = ['Swift'];
instead of 
Brush.aliases = ['swift'];

in the JS file.

This widget could not be displayed.

As mentioned in, we need to update Confluence versions as below

  • v5.9.14 or above
  • v5.10.3 or above


Then we don't need a fix of @Stefan Mayer-Popp.

Brush.aliases = ['swift'];


Here's the highlight sample applying to

  • Valid syntax highlight
    • Screenshot 2016-12-26 14.48.30.png
  • Invalid syntax highlight
    • Screenshot 2016-12-26 14.40.35.png


Hope this helps.

Would very much like to add support for other languages to Confluence. We contacted support, but were denied the request for this feature. Is there an alternative? Looks like our only option is to link out to GitHub Gists.

Stephen Deutsch Community Champion Sep 07, 2017

As long as your languages are standard ones, you may want to check the Marketplace for the "Better Code Macro" app from Atlassian. It's similar to the regular code macro but has support for many more programming languages, and it's free.

Hi Stephen, yes we found the Better Code Macro but we are have issues with it. We're getting a "There is no metadata configured for this macro..." error. Any ideas how to resolve that? Thanks

I have the same issue about "no metadata".

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 17, 2018 in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

580 views 7 6
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