Support for Swift language syntax highlighting?
Asked by Tim Trautmann:

*This question is in reference to Atlassian Documentation: [Code Block Macro](https://confluence.atlassian.com/pages/viewpage.action?pageId=724765175)*

Are there any plans to support Swift and Objective-C for proper syntax highlighting?  
[](https://community.atlassian.com/t5/Confluence-questions/Support-for-Swift-language-syntax-highlighting/qaq-p/207902?attachment-id=902){#link_11875add7e0485}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/35056/1/Screenshot%202016-12-26%2014.48.30.png){#display_11875add7e0485_0}  
[](https://community.atlassian.com/t5/Confluence-questions/Support-for-Swift-language-syntax-highlighting/qaq-p/207902?attachment-id=903){#link_11875add7e0485_0}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/35056/2/Screenshot%202016-12-26%2014.40.35.png){#display_11875add7e0485_2}  
[](https://community.atlassian.com/t5/Confluence-questions/Support-for-Swift-language-syntax-highlighting/qaq-p/207902?attachment-id=904){#link_11875add7e0485_1}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/35056/3/Bildschirmfoto%202016-03-11%20um%2023.28.14.png){#display_11875add7e0485_4}


Answers:
author: Stephen Deutsch
body: 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: <http://natecook.com/projects/swift-syntax-highlighting/>). 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:

comments: author: Stefan Mayer-Popp
body: 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


author: Stefan Mayer-Popp
body: 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.


author: K. Yamamoto
body: As mentioned in <https://jira.atlassian.com/browse/CONF-40325>, 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 <https://github.com/syntaxhighlighter/brush-swift/blob/v4.0.0/sample.txt>.

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

comments: author: Adolfo Martinelli
body: 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.


author: Stephen Deutsch
body: 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.


author: Adolfo Martinelli
body: 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


author: Stanislav Osipov
body: I have the same issue about "no metadata".


Tags: cloud

code-block

confluence-cloud

documentation