Installing additional Languages for Code Block Macro
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
As described in Code Block Macro, you can add new language highlighting to Code Block macro. This document explains how to identify the custom added languages in your Confluence instance and provides a list of open suggestions and references to other Code languages which are not part of the default ones.
Solution
Adding a new Code Language
To add an additional language:
- Go to Administration > General Configuration > Configure Code Macro.
- Choose Add a new language.
- Locate your language file and enter a Name for the new language (this will appear when selecting the language).
- Choose Add.
Language files must be correctly formatted JavaScript files and adhere to the Custom Brush syntax. You can see examples in <install-directory>/confluence/includes/js/third-party
.
Identifying added Code Languages
The Code Block Macro uses syntax highlighter brushes in the background, and these can be installed manually. When a new language in the code macro is added, Confluence wraps the brush file into a JAR File named install-language-LANGUAGENAME-XXXX.jar
which is located under the CONFLUENCE_HOME/temp
directory. In order to invoke it, a new entry is added into the PLUGINDATA table of the Confluence schema.
If you want to check what custom languages are installed, the simplest way is to run the following SQL statement:
SELECT substr(PLUGINKEY,42,strpos(substr(PLUGINKEY,42),'.')-1) AS LANGUAGE, FILENAME
FROM PLUGINDATA
WHERE PLUGINKEY LIKE 'com.atlassian.confluence.ext.code.custom.%'
Besides, the full list of out-of-the-box languages available in the Code block macro are available in our official documentation: Code Block Macro
Suggestions for Implementing new Code Languages
There are multiple suggestions opened for the implementation of additional languages as part of the out-of-the-box languages. If you or your business has any interest in having any of these suggestions implemented, feel free to vote to assess collectively the interest on each of them.
- - CONFSERVER-27832Getting issue details... STATUS
- - CONFSERVER-28735Getting issue details... STATUS
- - CONFSERVER-37128Getting issue details... STATUS
- - CONFSERVER-38060Getting issue details... STATUS
- - CONFSERVER-38596Getting issue details... STATUS
- - CONFSERVER-58961Getting issue details... STATUS
- - CONFSERVER-59078Getting issue details... STATUS
- - CONFSERVER-59362Getting issue details... STATUS
- - CONFSERVER-60524Getting issue details... STATUS
- - CONFSERVER-63191Getting issue details... STATUS
- - CONFSERVER-65851Getting issue details... STATUS
- - CONFSERVER-75167Getting issue details... STATUS
- - CONFSERVER-77571Getting issue details... STATUS
- - CONFSERVER-78411Getting issue details... STATUS
- - CONFSERVER-80176Getting issue details... STATUS
Additional Code Language files
Please be aware that this material is provided for your information only and that you use it at your own risk.
Atlassian Support cannot guarantee to provide any support for the code outlined on this page as customisations are not covered under Atlassian Support Offerings.
It is possible to find some brushes files available in our Confluence Knowledge Base and the Atlassian Community:
- JSON: How to highlight JSON in code block macro
- Verilog and VHDL: Atlassian Community > How to add a custom code block macro?