How to Make a Sample Code Block in Ghost Blog

Code blocks and syntax highlighting for technical blogs.

How to Make a Sample Code Block in Ghost Blog
Photo by Joan Gamell 

Create a code block

To add a block of code to a post or page, type three backticks (```) followed by the name of the coding language and hit tab or enter. For example, to add a block of javascript, write: ```javascript.

The code block will look like this unless you add syntax highlighting:

With syntax highlighting, the output looks like this:

<script src="" integrity="sha512-9khQRAUBYEJDCDVP2yw3LRUQvjJ0Pjx0EShmaQjcHa6AXiOv6qHQu9lCAIR8O+/D8FtaCoJ2c0Tf9Xo7hYH01Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="" integrity="sha512-fTl/qcO1VgvKtOMApX2PdZzkziyr2stM65GYPLGuYMnuMm1z2JLJG6XVU7C/mR+E7xBUqCivykuhlzfqxXBXbg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

Read this guide to add syntax highlighting:

Add Syntax Highlighting to Ghost CMS Code Block
How to add color to a code block in Ghost.

Ian Greer © . All rights reserved.