0

我正在用Scully创建一个博客,并寻找一种在那里设置代码高亮的好方法。

例如,这样的代码块(定义语言):

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

1 回答 1

0

我发现现在有两种方法:

  1. 使用库中包含的highlight.js 。你只需要在 Scully 配置中激活它:
setPluginConfig('md', { enableSyntaxHighlighting: true });
  1. Scully Docs建议通过安装Primsjs并将其包含到您的项目中来使用它。

看起来 Scully 团队想要摆脱对highlight.js的核心依赖,这就是为什么使用第二个选项是明智的。

于 2020-08-24T13:53:56.813 回答