forked from mirror/MrDoc
优化editormd编辑器预览界面代码高亮效果
This commit is contained in:
parent
2dd98ad186
commit
6fa1019175
@ -611,17 +611,8 @@
|
||||
editormd.loadScript(loadPath + "marked.min", function() {
|
||||
|
||||
editormd.$marked = marked;
|
||||
|
||||
if (settings.previewCodeHighlight)
|
||||
{
|
||||
editormd.loadScript(loadPath + "prettify.min", function() {
|
||||
loadFlowChartOrSequenceDiagram();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
loadFlowChartOrSequenceDiagram();
|
||||
}
|
||||
|
||||
loadFlowChartOrSequenceDiagram();
|
||||
});
|
||||
|
||||
});
|
||||
@ -1539,12 +1530,12 @@
|
||||
|
||||
if (settings.previewCodeHighlight)
|
||||
{
|
||||
previewContainer.find("pre").addClass("prettyprint linenums");
|
||||
|
||||
if (typeof prettyPrint !== "undefined")
|
||||
{
|
||||
prettyPrint();
|
||||
}
|
||||
previewContainer.find("pre").addClass("line-numbers language-bash");
|
||||
previewContainer.find("pre").attr('data-prismjs-copy','复制');
|
||||
previewContainer.find("pre").attr('data-prismjs-copy-error','按Ctrl+C复制');
|
||||
previewContainer.find("pre").attr('data-prismjs-copy-success','代码已复制!');
|
||||
let preCodes = Array.from(previewContainer.find("pre code"))
|
||||
preCodes.forEach(block => Prism.highlightElement(block));
|
||||
}
|
||||
|
||||
return this;
|
||||
@ -4425,7 +4416,6 @@
|
||||
|
||||
if (settings.previewCodeHighlight)
|
||||
{
|
||||
// div.find("pre").addClass("prettyprint linenums");
|
||||
editormd.loadScript(settings.plugin_path + 'raphael.min', function(){
|
||||
editormd.loadScript(settings.plugin_path + 'underscore.min', function(){
|
||||
// editormd.loadScript(settings.plugin_path + 'prettify.min',function(){
|
||||
|
@ -31,6 +31,7 @@
|
||||
<link href="{% static 'mrdoc/mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc-editor.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'tagsInput/tagsinput.css' %}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{% static 'prismjs/prism.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@ -259,6 +260,7 @@
|
||||
</script>
|
||||
<script src="{% static 'mrdoc/mrdoc.editor.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'mrdoc/mrdoc.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'prismjs/prism.js' %}?version={{mrdoc_version}}"></script>
|
||||
{% block custom_script %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user