找到高亮的js,css文件

Ueditor前台显示代码块高亮效果

把这个两个文件载入到你的static下面

然后在你的base.html  就是用的地方引用下面的代码

<link href="{% static 'js/SyntaxHighlighter/shCoreDefault.css' %}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{% static 'js/SyntaxHighlighter/shCore.js' %}"></script>
<script>
SyntaxHighlighter.all();//执行代码高亮
</script>

这样就成功了

Ueditor前台显示代码块高亮效果

当然代码显示的时候需要关闭转义,这样才是HTML代码  不然就是字符串了

Ueditor前台显示代码块高亮效果


相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-06-02
  • 2022-12-23
  • 2021-11-15
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2021-12-14
  • 2021-08-07
  • 2022-12-23
  • 2022-01-27
相关资源
相似解决方案