How could I to highlight code blocks in Scully?

61 Views Asked by At

I'm creating a blog with Scully and looking for a good way to setup code highlight there.

for example, such block of code(with defining the language):

```typescript
@NgModule({
  declarations: [BlogComponent],
  imports: [CommonModule, BlogRoutingModule, ScullyLibModule],
})
export class BlogModule {}
.```
1

There are 1 best solutions below

0
Stepan Suvorov On

I found that there are two ways now:

  1. Use highlight.js that is included in the library. You just need to activate it in Scully config:
setPluginConfig('md', { enableSyntaxHighlighting: true });
  1. Scully Docs suggest using Primsjs by installing it and including to your project.

It looks like Scully team wants to get rid of core dependency for highlight.js and that's why it's wise to use the second option.