Enhanced Code Block Documenation
Enhanced Code Block for Confluence is a Macro which contains all the features you could ever want from a code macro:
Secure - All data and code is stored and processed on Atlassian servers so no additional security risk
Syntax highlighting for over 300 languages, including Gherkin
One button to copy the code
Multiple themes to choose from to suit the page style or use different themes for different languages
Line highlighting to shows which bits of code are important
Macro can be configured to start collapsed so it does not make the document too long
Customizable title for each macro so you can let people know what the code is
Focus lines so you by default the Macro only shows a subset of lines but can be expanded
Configurable line numbers so you can choose to show them only when they are useful
Basic Usage
Edit a page or Create a new page and type /enhance click on the Enhanced Code Block option when it appears.
Click on the Edit pencil icon which appears below the newly inserted macro
Options will appear to the right hand side, write or copy and paste your code into the “Code to display” field and select the language from the Language dropdown. See below for instructions on all options.
Syntax Highlighting
Over 300 languages are supported, see the Supported Languages section for a full list.
To choose a language, simply click on the Language dropdown and either scroll to find your language or start typing and the list will be filtered so you can then easily select your language.
Themes
Enhanced Code Block comes with eight themes, simply select one from the dropdown, some examples are shown below
Default
Tomorrow Night
Line Highlighting
You can configure the Code Block to highlight certain lines to make them stand out. These are specified as groups separated by commas, each group can either by a single line number or a start and end range of lines separated by a hyphen -.
e.g. the below code has 1,3-4 set in the Lines to Highlight field
Auto Collapse
Long pieces of code can make clutter up a page and make it difficult to scroll. If you set Start collapsed with just title showing to Yes then only the title will be shown by default as below but you will still be able to easily open up the code when it is relevant to you by pressing the > button.
Custom Title
Your code blocks can have custom titles displayed at the top which can be used to give some context to the code and are very useful when the macro uses Auto Collapse.
Focus Lines
Focus Lines allow you to choose a subset of lines to be visible by default, but also allow viewers to expand to the full code snippet for more context using the + button. This is either a single line number or a range with start and end separated by a hyphen, e.g. 4 or 16-20.
Configurable Line Numbers
By default, line numbers are shown by you can choose to have them turned off if they are not relevant.
Supported Languages
.gitignore
.hgignore
.ignore
.npmignore
.properties
6502 Assembly
ABAP
ABNF
AL
ANTLR4
APL
AQL
ARFF
ARM Assembly
ASP.NET (C#)
AWK
ActionScript
Ada
Agda
Apache Configuration
Apex
AppleScript
Arduino
Arturo
AsciiDoc
Atmel AVR Assembly
Atom
AutoHotkey
AutoIt
AviSynth
Avro IDL
BASIC
BBcode
BBj
BNF
BQN
BSL (1C:Enterprise)
Bash
Batch
Bicep
Birb
Bison
Brainfuck
BrightScript
Bro
C
C#
C++
C-like
CFScript
CIL
CMake
COBOL
CSS
CSS Extras
CSV
CUE
ChaiScript
Cilk/C
Cilk/C++
Clojure
CoffeeScript
ConTeXt
Concurnas
Content-Security-Policy
Cooklang
Coq
Crystal
Cypher
D
DAX
DNS zone file
DOT (Graphviz)
Dart
DataWeave
Dhall
Diff
Django/Jinja2
Docker
EBNF
EJS
ERB
EditorConfig
Eiffel
Elixir
Elm
Embedded Lua templating
Erlang
Eta
Excel Formula
F#
Factor
False
Firestore security rules
Flow
Fortran
FreeMarker Template Language
G-code
GAP (CAS)
GAWK
GDScript
GEDCOM
GLSL
GN
GNU Linker Script
GameMaker Language
Gherkin
Git
Go
Go module
Gradle
GraphQL
Groovy
HCL
HLSL
HTML
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
Haml
Handlebars
Haskell
Haxe
Hoon
ICU Message Format
IchigoJam
Icon
Idris
Inform 7
Ini
Io
J
JQ
JS Extras
JS Templates
JS stack trace
JSDoc
JSON
JSON5
JSONP
Java
Java stack trace
JavaDoc
JavaDoc-like
JavaScript
Jexl
Jolie
Julia
Keepalived Configure
Keyman
Kotlin
Kotlin Script
KuMir (КуМир)
Kusto
LLVM IR
LOLCODE
LaTeX
Latte
Less
LilyPond
Liquid
Lisp
LiveScript
Log file
Lua
MATLAB
MAXScript
MEL
METAFONT
Magma (CAS)
Makefile
Markdown
Markup
Markup templating
Mata
MathML
Mathematica
Mathematica Notebook
Mermaid
Mizar
MongoDB
Monkey
MoonScript
Mustache
N1QL
N4JS
NASM
NEON
NSIS
Nand To Tetris HDL
Naninovel Script
Nevod
Nim
Nix
OCaml
Object Pascal
Objective-C
Odin
OneScript
OpenCL
OpenQasm
Oz
PARI/GP
PATROL Scripting Language
PC-Axis
PHP
PHP Extras
PHPDoc
PL/SQL
Parser
Pascal
Pascaligo
PeopleCode
Perl
PlantUML
PowerQuery
PowerShell
Processing
Prolog
PromQL
Protocol Buffers
Pug
Puppet
Pure
PureBasic
PureScript
Python
Q (kdb+ database)
Q#
QML
Qore
R
RBNF
RSS
Racket
Razor C#
ReScript
React JSX
React TSX
Reason
Regex
Rego
Ren'py
Rip
Roboconf
Robot Framework
Ruby
Rust
SAS
SML
SML/NJ
SPARQL
SQF: Status Quo Function (Arma 3)
SQL
SSML
SVG
Sass (SCSS)
Sass (Sass)
Scala
Scheme
Shell
Shell
Shell session
Shortcode
Smali
Smalltalk
Smarty
Solidity (Ethereum)
Solution file
Soy (Closure Template)
Splunk SPL
Squirrel
Stan
Stata Ado
Structured Text (IEC 61131-3)
Stylus
SuperCollider
Swift
Systemd configuration file
T4 Text Templates (C#)
T4 Text Templates (VB)
T4 templating
TAP
TOML
TSConfig
Tcl
TeX
Template Toolkit 2
Textile
Tremor
TriG
Turtle
Twig
TypeScript
TypoScript
UO Razor Script
URI
URL
UnrealScript
V
VB.Net
VBA
VHDL
Vala
Velocity
Verilog
Visual Basic
WGSL
WarpScript
Web App Manifest
Web IDL
WebAssembly
Wiki markup
Wolfram language
Wren
XML
XML doc (.net)
XQuery
Xeora
XeoraCube
Xojo (REALbasic)
YAML
YANG
Zig
gettext
nginx
reST (reStructuredText)
trickle
troy
vim