* https://blog.csdn.net/qq_38504396/article/details/79835475 *
# ckeditor configs
CKEDITOR_CONFIGS = {
'language': 'zh-cn',
'awesome_ckeditor': {
'toolbar': 'full',
'width': 'auto',
'height': '480px',
'tabSpaces': 4,
# 插件
# prism:代码高亮、代码行数
# uploadimage:允许用户直接在编辑器里粘贴(ctrl + v)图片
# codesnippet:添加代码块的功能
'extraPlugins': ','.join(['codesnippet', 'uploadimage', 'prism', 'widget', 'lineutils', ]),
},
}
* 内容必须是代码块,即含有 pre 标签,再选择代码语言,不选择代码语言默认黑白框 *
<script src="{% static 'ckeditor/ckeditor/plugins/prism/lib/prism/prism_patched.min.js' %}"></script>
<script src="{% static 'js/prism.js' %}"></script>
<link rel="stylesheet" href="{% static 'css/prism.css' %}">