Guides/Create content/Code/Display code snippets

Display code snippets

Last reviewed on January 19, 2026

The Code block displays code on your site with syntax highlighting, making it ideal for code snippets in tutorials and technical documentation. In this guide, you will learn how to add a Code block, customize its appearance, and use its enhanced features.

Add a Code block

To add a Code block to your page or post, follow these steps:

  1. Click the + block inserter button and search for “Code.”
  2. Click the Code block to add it to your content.
The Code block highlighted in the block inserter.
  1. Paste or write your code in the Code block.
The Code block with the text "Write code..." in it.

💡

Type /code on a new line and press Enter to quickly add a Code block.

For more information, visit our detailed instructions on adding blocks.

Select a code language

The Code block supports syntax highlighting for many programming languages. When you select a language, your code displays with color-coded formatting that makes it easier to read.

To select a language, follow these steps:

  1. Click on your Code block to select it.
  2. In the block toolbar, click the language dropdown (set to “Plain Text” by default).
  3. Select your desired language from the list.
An arrow from the "Plain text" option in the toolbar to the drop-down with other code language options.

The syntax highlighting appears both in the editor and on the published page.

The Code block with JavaScript selected.

Supported languages

The Code block supports syntax highlighting for over 120 programming languages, including popular options like JavaScript, TypeScript, PHP, Python, HTML, CSS, JSON, SQL, Ruby, and Shell.

View all supported languages
  • Plain text
  • APL
  • ASN.1
  • Brainf***
  • C
  • C#
  • C++
  • Clojure
  • ClojureScript
  • Closure Stylesheets (GSS)
  • CMake
  • Cobol
  • CoffeeScript
  • Common Lisp
  • CQL
  • Crystal
  • CSS
  • Cypher
  • Cython
  • D
  • Dart
  • diff
  • DTD
  • Dylan
  • ECL
  • edn
  • Eiffel
  • Elm
  • Erlang
  • F#
  • Factor
  • Forth
  • Fortran
  • Gas
  • Gherkin
  • Go
  • Groovy
  • Haskell
  • Haxe
  • HTML
  • HXML
  • IDL
  • Java
  • JavaScript
  • Jinja2
  • JSON
  • JSON-LD
  • JSX
  • Julia
  • Kotlin
  • LaTeX
  • LESS
  • Liquid
  • LiveScript
  • Log
  • Lua
  • Markdown
  • Mathematica
  • Mbox
  • mIRC
  • Modelica
  • MscGen
  • MsGenny
  • MUMPS
  • NSIS
  • NTriples
  • Objective-C
  • Objective-C++
  • OCaml
  • Octave
  • Oz
  • Pascal
  • Perl
  • PGP
  • PHP
  • Pig
  • PLSQL
  • PowerShell
  • Properties files
  • ProtoBuf
  • Pug
  • Puppet
  • Python
  • Q
  • R
  • RPM Spec
  • Ruby
  • Rust
  • SAS
  • Sass
  • Scala
  • Scheme
  • SCSS
  • Shell
  • Sieve
  • Smalltalk
  • SML
  • SPARQL
  • SQL
  • Squirrel
  • Stylus
  • Swift
  • SystemVerilog
  • Tcl
  • Textile
  • TOML
  • Troff
  • TSX
  • TTCN
  • TTCN_CFG
  • Turtle
  • TypeScript
  • VB.NET
  • VBScript
  • Velocity
  • Verilog
  • VHDL
  • Vue
  • Web IDL
  • WebAssembly
  • XML
  • XQuery
  • Yacas
  • YAML
  • Z80

Code block settings

The Code block includes several display options to enhance readability and usability for your visitors.

To access the Code block‘s settings, follow these steps:

  1. Click on your Code block to select it.
  2. Open the block settings in the right sidebar.

The Code block includes the following settings:

  • Language: Select the code language.
  • Filename: Display a filename at the beginning of your code block so readers know which file to edit or create.
  • Show language name: Display the programming language name at the beginning of your code block.
  • Show copy button: Add a button that allows visitors to copy your code with one click.
  • Show line numbers: Add line numbers to help readers reference specific lines of code.
The sidebar settings for the Code block.

Code block styles

The Code block offers style variations to match your site’s design.

To access the Code block’s styles, follow these steps:

  1. Click on your Code block to select it.
  2. Open the block settings in the right sidebar.
  3. Click the Styles icon in the sidebar.

The Code block includes the following styles:

A box drawn around the Styles icon in the sidebar settings for the Code block.

Was this guide helpful for you?

Not quite what you're looking for? Get Help!

Copied to clipboard!