经验分享

百度编辑器代码高亮代码

我的站长站 2019-03-01 人阅读

百度编辑器代码如何高亮

在需要高亮的页面尾部加入高亮代码就可以了

<script src="ueditor/third-party/SyntaxHighlighter/shCore.js" type="text/javascript"></script>        
<link rel="stylesheet" href="ueditor/third-party/SyntaxHighlighter/shCoreDefault.css">    
<script type="text/javascript">SyntaxHighlighter.all();</script>

百度编辑器代码自动换行

找到高亮代码显示的css文件  ueditor/third-party/SyntaxHighlighter/shCoreDefault.css文件

查找

.syntaxhighlighter{width:100%!important;margin:.3em 0 .3em 0!important;position:relative!important;overflow:auto!important;background-color:#f5f5f5!important;border:1px solid #ccc!important;

替换成

.syntaxhighlighter{width:100%!important;margin:.3em 0 .3em 0!important;position:relative!important;overflow:auto!important;background-color:#f5f5f5!important;border:1px solid #ccc!important;word-break:break-all;

主要是加了word-break:break-all;这个CSS自动换行样式属性。

百度编辑器代码行间距

找到高亮代码显示的css文件  ueditor/third-party/SyntaxHighlighter/shCoreDefault.css文件

查找

line-height:1.1em!important;

替换成

line-height:25px!important;

具体行间距自己设置

相关专题
编辑器
编辑器
2021-05-14 230

编辑器是网站开发与内容发布的必备核心工具。本专题精心整理多款常用网页编辑器资源,涵盖各大主流CMS适配编辑器插件、开源HTML可视化编辑器源码、富文本编辑组件...