In many technical blogs, we use code snippets to share code with readers and explain the implementation. In a previous article, we have seen how to create a blogging site with Angular and Scully. If you are creating a technical blogging site you might also need to add code snippets to your blog.
So In this article, we will see how to add a code block with syntax highlighting feature. We will continue working on the previous article example, If you want to code along with that example clone or download the code from this GitHub Repository
Previous Articles of Scully Series,
In the markdown file, we can add a code block with the following syntax,
So In this article, we will see how to add a code block with syntax highlighting feature. We will continue working on the previous article example, If you want to code along with that example clone or download the code from this GitHub Repository
Previous Articles of Scully Series,
- Getting Started With Scully - Angular Static Site Generator
- Create Blogging Site With Angular and Scully
Adding Code Block in Markdown file
In the markdown file, we can add a code block with the following syntax,
- ```
- --- CODE BLOCK ---
- ```
Optionally you can also set the language as
- ```language
- --- CODE BLOCK ---
- ```
For Example,
Add the following sample code block in getting-started-with-scully.md file
- ```javascript
- import { ScullyConfig } from '@scullyio/scully';
- export const config: ScullyConfig = {
- projectRoot: "./src",
- projectName: "portfolio",
- outDir: './dist/static',
- routes: {
- '/blog/:slug': {
- type: 'contentFolder',
- slug: {
- folder: "./blog"
- }
- },
- }
- };
- ```



Join the conversation! Your thoughts help the community grow.