mirror of https://github.com/halo-dev/halo
✨ 编辑器支持数学公式 #50
parent
12e8e68655
commit
efd874b3d6
|
@ -135,6 +135,7 @@
|
||||||
<script src="/static/plugins/inline-attachment/codemirror-4.inline-attachment.min.js"></script>
|
<script src="/static/plugins/inline-attachment/codemirror-4.inline-attachment.min.js"></script>
|
||||||
<script src="/static/plugins/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
<script src="/static/plugins/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||||
<script src="/static/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
|
<script src="/static/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
|
||||||
|
<script src="//cdnjs.loli.net/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script>
|
||||||
<script>
|
<script>
|
||||||
<#if post??>
|
<#if post??>
|
||||||
$('#postDate').datetimepicker({
|
$('#postDate').datetimepicker({
|
||||||
|
@ -145,6 +146,13 @@
|
||||||
autoclose: 1
|
autoclose: 1
|
||||||
});
|
});
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
MathJax.Hub.Config({
|
||||||
|
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
|
||||||
|
});
|
||||||
|
|
||||||
|
var QUEUE = MathJax.Hub.queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载编辑器
|
* 加载编辑器
|
||||||
*/
|
*/
|
||||||
|
@ -160,8 +168,14 @@
|
||||||
renderingConfig: {
|
renderingConfig: {
|
||||||
codeSyntaxHighlighting: true
|
codeSyntaxHighlighting: true
|
||||||
},
|
},
|
||||||
|
previewRender: function(plainText) {
|
||||||
|
var preview = document.getElementsByClassName("editor-preview-side")[0];
|
||||||
|
preview.innerHTML = this.parent.markdown(plainText);
|
||||||
|
preview.setAttribute('id','editor-preview');
|
||||||
|
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"editor-preview"]);
|
||||||
|
return preview.innerHTML;
|
||||||
|
},
|
||||||
showIcons: ["code", "table"],
|
showIcons: ["code", "table"],
|
||||||
status: true,
|
|
||||||
status: ["autosave", "lines", "words"],
|
status: ["autosave", "lines", "words"],
|
||||||
tabSize: 4
|
tabSize: 4
|
||||||
});
|
});
|
||||||
|
|
|
@ -190,6 +190,7 @@
|
||||||
<script src="/static/plugins/hz2py/jQuery.Hz2Py-min.js"></script>
|
<script src="/static/plugins/hz2py/jQuery.Hz2Py-min.js"></script>
|
||||||
<script src="/static/plugins/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
<script src="/static/plugins/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||||
<script src="/static/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
|
<script src="/static/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
|
||||||
|
<script src="//cdnjs.loli.net/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script>
|
||||||
<script>
|
<script>
|
||||||
<#if post??>
|
<#if post??>
|
||||||
$('#postDate').datetimepicker({
|
$('#postDate').datetimepicker({
|
||||||
|
@ -200,6 +201,13 @@
|
||||||
autoclose: 1
|
autoclose: 1
|
||||||
});
|
});
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
MathJax.Hub.Config({
|
||||||
|
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
|
||||||
|
});
|
||||||
|
|
||||||
|
var QUEUE = MathJax.Hub.queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载编辑器
|
* 加载编辑器
|
||||||
*/
|
*/
|
||||||
|
@ -215,8 +223,14 @@
|
||||||
renderingConfig: {
|
renderingConfig: {
|
||||||
codeSyntaxHighlighting: true
|
codeSyntaxHighlighting: true
|
||||||
},
|
},
|
||||||
|
previewRender: function(plainText) {
|
||||||
|
var preview = document.getElementsByClassName("editor-preview-side")[0];
|
||||||
|
preview.innerHTML = this.parent.markdown(plainText);
|
||||||
|
preview.setAttribute('id','editor-preview');
|
||||||
|
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"editor-preview"]);
|
||||||
|
return preview.innerHTML;
|
||||||
|
},
|
||||||
showIcons: ["code", "table"],
|
showIcons: ["code", "table"],
|
||||||
status: true,
|
|
||||||
status: ["autosave", "lines", "words"],
|
status: ["autosave", "lines", "words"],
|
||||||
tabSize: 4
|
tabSize: 4
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue