Display syntax-highlighted code

Use the Code block to display syntax-highlighted code in a presentation. Select a language and theme, then type or paste your code. Highlighting updates in real time.

Selecting a language and highlighting theme for a Code block

Line numbers and line highlights

Turn line numbers on or off in the block toolbar. To draw attention to specific lines, enter a comma-separated list of line numbers or ranges. For example:

  • 1,4,10 highlights lines 1, 4, and 10.
  • 2,5-15 highlights line 2 and lines 5 through 15.

Enabling line numbers and highlighting selected lines

Supported languages

Syntax highlighting is powered by the open-source highlight.js project. Slides supports the languages listed in the highlight.js demo.

Code highlighting in action