KindEditor4.1.4代码高亮显示设置
来源:互联网 发布:怎么跟淘宝客服讲价 编辑:程序博客网 时间:2024/05/20 01:46
在线编辑器KindEditor很强大,但是默认没有开启代码高亮功能。网上找到了一些方法。
1.后台还需要加载prettify.js和prettify.css
<script src="editor/plugins/code/prettify.js"></script><link rel="stylesheet" href="editor/plugins/code/prettify.css">
编辑器初始化设置后,在里面加cssPath(注意路径)和prettyPrint()
KindEditor.ready(function(K) {window.editor = K.create('#editor_id',{cssPath:'editor/plugins/code/prettify.css',resizeType:0,items:[ 'undo', 'redo', '|','selectall','cut', 'copy', 'paste','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull','|','insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', '|','clearhtml', 'quickformat', 'removeformat', '|', 'source','preview','fullscreen', '/', 'formatblock', 'fontname', 'fontsize', '|','forecolor', 'hilitecolor', 'bold','italic', 'underline', 'strikethrough', 'lineheight', '|','code','image','table', 'hr', 'emoticons', 'baidumap', 'pagebreak', 'anchor', 'link', 'unlink']});prettyPrint();});
2.前端要显示,添加如下代码
<link type="text/css" rel="stylesheet" href="editor/plugins/code/prettify.css"/><script type="text/javascript" src="editor/plugins/code/prettify.js"></script><script>prettyPrint();</script>代码显示默认不会换行,若要换行,需要在plugins/code下的prettify.css中添加以下内容
pre.prettyprint {width: 630px;//代码宽度margin: 1em auto;padding: 1em;white-space: pre-wrap;}
1 0
- KindEditor4.1.4代码高亮显示设置
- jQuery编辑器KindEditor4.1.4代码高亮显示设置
- jQuery编辑器KindEditor4.1.4代码高亮显示设置
- kindeditor4.x 代码高亮
- kindeditor4.x整合SyntaxHighlighter代码高亮
- kindeditor4.x整合SyntaxHighlighter代码高亮
- PhpStorm支持dwt文件代码高亮显示设置方法
- vim编辑器代码高亮/显示行号/自动缩进设置
- 设置代码高亮
- CUDA 高亮显示设置
- Eclipse 高亮显示设置
- grep高亮显示设置
- VS设置高亮显示
- 在线代码高亮显示
- 测试代码高亮显示
- SyntaxHighlighter高亮显示代码
- OneNote 设置代码高亮
- MyEclipse 高亮显示数据行中JAVA代码变量的设置
- 更新PIL库后遇到NotImplementedError: tostring() has been removed. Please call tobytes() instead
- 【京东商城首页实战2】导航条制作(1)
- 轻松学会ES6新特性之生成器
- 位运算的优势
- js 获取select的值 / js动态给select赋值
- KindEditor4.1.4代码高亮显示设置
- 设计模式之代理模式
- Unreal Engin_画廊制作笔记 _009<灯光处理,夜晚的画廊Spot Light灯光设置>
- MFC+opencv双目测距
- Java面试题集(二)
- 20701除法
- Linux Apache服务介绍及搭建
- Gradle build.gradle样例文件 Groovy语法 注解
- Profile-多环境配置