All Collections
Posts
Advanced formatting
Using code blocks in posts
Using code blocks in posts

Embed code with syntax highlighting and render results into posts

Updated over a week ago

Code blocks are a powerful formatting tool for tech-savvy teams who want to document and collaborate on code. With Slab, you can easily embed code with syntax highlighting and even see the rendered result right in the post.

Creating a code block

The fastest way to create a code block is through our shortcuts. Simply type ``` on a new line and press Enter. To specify the language for the code block from the get-go: use ```[language], such as ```js.

You can also create a code block using our formatting menu:

  1. Type "/code block" on a new line and press Enter.

  2. Hover over the code block and click the dropdown menu.

  3. Select your programming language.

Did this answer your question?