highlight.js 可以自动识别 pre code 进行代码美化
你可以这样使用
```
<link href='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css' rel='stylesheet'/>
<script src='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js'/>
<script>hljs.initHighlightingOnLoad();</script>
```
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijsybcwxr28P7nive0JTFZkjq-40Vx5yx6CWBAhQV-jFgk7auRaZiwf4ijFS2Z7brrKOKa8sNQUH5Rut1ItkyY4F_utkIE7MeOOhCKTd3zp3t4jHLVIh-fmrqc-PjVdyBC7LuHUabRl4_aiWUEpJYMnnrrWNmPtQ0cQkX-Cy5TgxUL0ngXdVtxCAeLhNKE/s1600/chrome_2024-10-02_14-27-24.png)
评论
发表评论