Commit 6f0f2b5b authored by Van's avatar Van

math 改进

parent 12f7594d
......@@ -106,13 +106,11 @@ var Util = {
if ($(this).text().split('$').length > 2 ||
($(this).text().split('\\(').length > 1 &&
$(this).text().split('\\)').length > 1)) {
hasMathJax = true;
return false;
hasMathJax = true
}
});
})
if ($(this).find('code.lang-flow, code.language-flow').length > 0) {
hasFlow = true
return false;
}
});
......@@ -120,27 +118,30 @@ var Util = {
var initMathJax = function () {
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$', '$'], ["\\(", "\\)"]],
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$']],
processEscapes: true,
processEnvironments: true,
skipTags: ['pre', 'code', 'script']
skipTags: ['pre', 'code', 'script'],
},
asciimath2jax: {
delimiters: [['$','$']]
}
});
MathJax.Hub.Typeset();
};
})
MathJax.Hub.Typeset()
}
if (typeof MathJax !== 'undefined') {
initMathJax();
initMathJax()
} else {
$.ajax({
method: "GET",
url: "https://cdn.staticfile.org/MathJax/MathJax-2.6-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&_=1473258780393",
dataType: "script",
cache: true
method: 'GET',
url: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML',
dataType: 'script',
cache: true,
}).done(function () {
initMathJax();
});
initMathJax()
})
}
}
......
This diff is collapsed.
/*!
* Vditor v0.2.5 - A markdown editor written in TypeScript.
*
* MIT License
*
* Copyright (c) 2019 B3log 开源, b3log.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/@-webkit-keyframes tooltip-appear{0%{opacity:0}to{opacity:1}}@keyframes tooltip-appear{0%{opacity:0}to{opacity:1}}.vditor-tooltipped{position:relative;cursor:pointer}.vditor-tooltipped:after{z-index:1000000;padding:5px 8px;font-size:11px;font-weight:400;-webkit-font-smoothing:subpixel-antialiased;color:#fff;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;content:attr(aria-label);background:rgba(0,0,0,.8);border-radius:3px;line-height:16px}.vditor-tooltipped:after,.vditor-tooltipped:before{position:absolute;display:none;pointer-events:none;opacity:0}.vditor-tooltipped:before{z-index:1000001;width:0;height:0;color:rgba(0,0,0,.8);content:"";border:5px solid transparent}.vditor-tooltipped--hover:after,.vditor-tooltipped--hover:before,.vditor-tooltipped:active:after,.vditor-tooltipped:active:before,.vditor-tooltipped:focus:after,.vditor-tooltipped:focus:before,.vditor-tooltipped:hover:after,.vditor-tooltipped:hover:before{display:inline-block;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:.4s;animation-delay:.4s}.vditor-tooltipped__s:after,.vditor-tooltipped__se:after,.vditor-tooltipped__sw:after{top:100%;right:50%;margin-top:5px}.vditor-tooltipped__s:before,.vditor-tooltipped__se:before,.vditor-tooltipped__sw:before{top:auto;right:50%;bottom:-5px;margin-right:-5px;border-bottom-color:rgba(0,0,0,.8)}.vditor-tooltipped__se:after{right:auto;left:50%;margin-left:-15px}.vditor-tooltipped__sw:after{margin-right:-15px}.vditor-tooltipped__n:after,.vditor-tooltipped__ne:after,.vditor-tooltipped__nw:after{right:50%;bottom:100%;margin-bottom:5px}.vditor-tooltipped__n:before,.vditor-tooltipped__ne:before,.vditor-tooltipped__nw:before{top:-5px;right:50%;bottom:auto;margin-right:-5px;border-top-color:rgba(0,0,0,.8)}.vditor-tooltipped__ne:after{right:auto;left:50%;margin-left:-15px}.vditor-tooltipped__nw:after{margin-right:-15px}.vditor-tooltipped__n:after,.vditor-tooltipped__s:after{-webkit-transform:translateX(50%);transform:translateX(50%)}.vditor-tooltipped__w:after{right:100%;bottom:50%;margin-right:5px;-webkit-transform:translateY(50%);transform:translateY(50%)}.vditor-tooltipped__w:before{top:50%;bottom:50%;left:-5px;margin-top:-5px;border-left-color:rgba(0,0,0,.8)}.vditor-tooltipped__e:after{bottom:50%;left:100%;margin-left:5px;-webkit-transform:translateY(50%);transform:translateY(50%)}.vditor-tooltipped__e:before{top:50%;right:-5px;bottom:50%;margin-top:-5px;border-right-color:rgba(0,0,0,.8)}.vditor-panel{background-color:#fff;position:absolute;box-shadow:0 1px 2px rgba(0,0,0,.2);border-radius:3px;padding:5px;z-index:1;font-size:14px;display:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-width:200px;min-width:80px}.vditor-panel h1,.vditor-panel h2,.vditor-panel h3,.vditor-panel h4,.vditor-panel h5,.vditor-panel h6{margin:0;cursor:pointer;padding:3px 10px;border-radius:3px;line-height:normal}.vditor-panel h1:hover,.vditor-panel h2:hover,.vditor-panel h3:hover,.vditor-panel h4:hover,.vditor-panel h5:hover,.vditor-panel h6:hover{background-color:#4285f4;color:#fff}.vditor-toolbar{background-color:#f6f8fa;border-bottom:1px solid #d1d5da;padding:0 5px;border-radius:3px 3px 0 0}.vditor-toolbar>div{padding:10px 5px;float:left;line-height:14px;height:36px;box-sizing:border-box}.vditor-toolbar svg{fill:currentColor;display:inline-block;stroke-width:0;stroke:currentColor;width:14px;height:14px}.vditor-toolbar .vditor-tooltipped{color:#586069}.vditor-toolbar .vditor-tooltipped:hover{color:#4285f4}.vditor-toolbar label{overflow:hidden;position:relative;height:14px;width:15px;display:block;cursor:pointer}.vditor-toolbar input{position:absolute;width:1px;opacity:.001;height:14px;overflow:hidden}.vditor-menu--current svg{color:#4285f4}.vditor-menu__divider{width:10px}.vditor-menu__br{width:100%;padding:0!important;height:0!important}.vditor-emojis{display:inline-block}.vditor-emojis__tail{font-size:12px;text-align:right;color:#586069}.vditor-emojis__tail a{text-decoration:none;color:#586069}.vditor-emojis__tail a:hover{color:#4285f4}.vditor-emojis span{cursor:pointer;border-radius:3px;float:left;height:26px;width:26px;text-align:center;line-height:20px;padding:3px;box-sizing:border-box;font-size:16px}.vditor-emojis span:hover{background-color:#4285f4}.vditor-emojis img{height:20px;width:20px;float:left}.vditor{display:flex;flex-direction:column;border:1px solid #d1d5da;border-radius:3px;box-sizing:border-box}.vditor--fullscreen{position:fixed;top:0;width:100%!important;left:0;height:100vh!important;z-index:90;background-color:#fff}.vditor-content{display:flex;min-height:60px;flex:1;position:relative}.vditor-textarea{flex:1;border:0;resize:none;padding:10px;box-sizing:border-box;background-color:#fafbfc;outline:0 none;font-size:16px;line-height:22px;color:#24292e;border-radius:0 0 3px 3px}.vditor-textarea[disabled]{opacity:.3;cursor:not-allowed}.vditor-preview,.vditor-textarea:focus{background-color:#fff}.vditor-preview{flex:1;overflow:auto;padding:10px;box-shadow:inset 1px 0 #d1d5da;box-sizing:border-box;border-radius:0 0 3px 0}.vditor-preview::-webkit-scrollbar{display:none}.vditor-counter{padding:0 3px;position:absolute;bottom:10px;right:20px;color:#24292e;background-color:hsla(0,0%,100%,.6);border-radius:3px;font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vditor-counter--error{color:#d23f31;background-color:rgba(210,63,49,.1)}.vditor-resize{padding:1px 0;border-radius:5px;cursor:row-resize;transition:all .15s ease-in-out;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#f6f8fa}.vditor-resize:hover{background-color:#4285f4}.vditor-resize:hover svg{color:#fff}.vditor-resize svg{fill:currentColor;stroke-width:0;stroke:currentColor;width:13px;height:3px;display:block;margin:0 auto;color:#586069}.vditor-upload{opacity:0;position:absolute;width:100%;height:5px;left:0;top:-3px;border-radius:3px;overflow:hidden;transition:all .15s ease-in-out}.vditor-upload--tip{height:20px;font-size:12px;line-height:20px;color:#fff;opacity:1!important}.vditor-upload--tip .vditor-upload__close{position:absolute;right:5px;top:0;cursor:pointer;display:block}.vditor-upload--tip .vditor-upload__progress{padding:0 5px}.vditor-upload__close{display:none}.vditor-upload__progress{height:100%;background-color:rgba(66,133,244,.8);transition:all .15s ease-in-out}.vditor-hint{background-color:#fff;position:absolute;box-shadow:0 1px 2px rgba(0,0,0,.2);border-radius:3px;padding:5px 0;z-index:1;line-height:20px;list-style:none;color:#24292e;font-size:12px;margin:0;max-width:200px;min-width:80px;display:none}.vditor-hint li{cursor:pointer;padding:3px 10px;border-bottom:1px solid #d1d5da;line-height:20px}.vditor-hint li:last-child{border-bottom:0}.vditor-hint--current,.vditor-hint li:hover{background-color:#4285f4;color:#fff}.vditor-hint__emoji{font-size:16px;float:left;margin-right:3px}.vditor-hint img{height:20px;width:20px;float:left;margin-right:3px}
\ No newline at end of file
/*!
* Vditor v0.2.5 - A markdown editor written in TypeScript.
*
* MIT License
*
* Copyright (c) 2019 B3log 开源, b3log.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/@-webkit-keyframes tooltip-appear{0%{opacity:0}to{opacity:1}}@keyframes tooltip-appear{0%{opacity:0}to{opacity:1}}.vditor-tooltipped{position:relative;cursor:pointer}.vditor-tooltipped:after{z-index:1000000;padding:5px 8px;font-size:11px;font-weight:400;-webkit-font-smoothing:subpixel-antialiased;color:#fff;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;content:attr(aria-label);background:rgba(0,0,0,.8);border-radius:3px;line-height:16px}.vditor-tooltipped:after,.vditor-tooltipped:before{position:absolute;display:none;pointer-events:none;opacity:0}.vditor-tooltipped:before{z-index:1000001;width:0;height:0;color:rgba(0,0,0,.8);content:"";border:5px solid transparent}.vditor-tooltipped--hover:after,.vditor-tooltipped--hover:before,.vditor-tooltipped:active:after,.vditor-tooltipped:active:before,.vditor-tooltipped:focus:after,.vditor-tooltipped:focus:before,.vditor-tooltipped:hover:after,.vditor-tooltipped:hover:before{display:inline-block;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:.4s;animation-delay:.4s}.vditor-tooltipped__s:after,.vditor-tooltipped__se:after,.vditor-tooltipped__sw:after{top:100%;right:50%;margin-top:5px}.vditor-tooltipped__s:before,.vditor-tooltipped__se:before,.vditor-tooltipped__sw:before{top:auto;right:50%;bottom:-5px;margin-right:-5px;border-bottom-color:rgba(0,0,0,.8)}.vditor-tooltipped__se:after{right:auto;left:50%;margin-left:-15px}.vditor-tooltipped__sw:after{margin-right:-15px}.vditor-tooltipped__n:after,.vditor-tooltipped__ne:after,.vditor-tooltipped__nw:after{right:50%;bottom:100%;margin-bottom:5px}.vditor-tooltipped__n:before,.vditor-tooltipped__ne:before,.vditor-tooltipped__nw:before{top:-5px;right:50%;bottom:auto;margin-right:-5px;border-top-color:rgba(0,0,0,.8)}.vditor-tooltipped__ne:after{right:auto;left:50%;margin-left:-15px}.vditor-tooltipped__nw:after{margin-right:-15px}.vditor-tooltipped__n:after,.vditor-tooltipped__s:after{-webkit-transform:translateX(50%);transform:translateX(50%)}.vditor-tooltipped__w:after{right:100%;bottom:50%;margin-right:5px;-webkit-transform:translateY(50%);transform:translateY(50%)}.vditor-tooltipped__w:before{top:50%;bottom:50%;left:-5px;margin-top:-5px;border-left-color:rgba(0,0,0,.8)}.vditor-tooltipped__e:after{bottom:50%;left:100%;margin-left:5px;-webkit-transform:translateY(50%);transform:translateY(50%)}.vditor-tooltipped__e:before{top:50%;right:-5px;bottom:50%;margin-top:-5px;border-right-color:rgba(0,0,0,.8)}.vditor-panel{background-color:#fff;position:absolute;box-shadow:0 1px 2px rgba(0,0,0,.2);border-radius:3px;padding:5px;z-index:1;font-size:14px;display:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-width:200px;min-width:80px}.vditor-panel h1,.vditor-panel h2,.vditor-panel h3,.vditor-panel h4,.vditor-panel h5,.vditor-panel h6{margin:0;cursor:pointer;padding:3px 10px;border-radius:3px;line-height:normal}.vditor-panel h1:hover,.vditor-panel h2:hover,.vditor-panel h3:hover,.vditor-panel h4:hover,.vditor-panel h5:hover,.vditor-panel h6:hover{background-color:#2c2c2c;color:#fff}.vditor-toolbar{background-color:#2c2c2c;border-bottom:1px solid #fff;padding:0 5px;border-radius:3px 3px 0 0}.vditor-toolbar>div{padding:10px 5px;float:left;line-height:14px;height:36px;box-sizing:border-box}.vditor-toolbar svg{fill:currentColor;display:inline-block;stroke-width:0;stroke:currentColor;width:14px;height:14px}.vditor-toolbar .vditor-tooltipped{color:#b9b9b9}.vditor-toolbar .vditor-tooltipped:hover{color:#fff}.vditor-toolbar label{overflow:hidden;position:relative;height:14px;width:15px;display:block;cursor:pointer}.vditor-toolbar input{position:absolute;width:1px;opacity:.001;height:14px;overflow:hidden}.vditor-menu--current svg{color:#fff}.vditor-menu__divider{width:10px}.vditor-menu__br{width:100%;padding:0!important;height:0!important}.vditor-emojis{display:inline-block}.vditor-emojis__tail{font-size:12px;text-align:right;color:#b9b9b9}.vditor-emojis__tail a{text-decoration:none;color:#b9b9b9}.vditor-emojis__tail a:hover{color:#2c2c2c}.vditor-emojis span{cursor:pointer;border-radius:3px;float:left;height:26px;width:26px;text-align:center;line-height:20px;padding:3px;box-sizing:border-box;font-size:16px}.vditor-emojis span:hover{background-color:#2c2c2c}.vditor-emojis img{height:20px;width:20px;float:left}.vditor{display:flex;flex-direction:column;border:1px solid #fff;border-radius:3px;box-sizing:border-box}.vditor--fullscreen{position:fixed;top:0;width:100%!important;left:0;height:100vh!important;z-index:90;background-color:#fff}.vditor-content{display:flex;min-height:60px;flex:1;position:relative}.vditor-textarea{flex:1;border:0;resize:none;padding:10px;box-sizing:border-box;background-color:#fff;outline:0 none;font-size:16px;line-height:22px;color:rgba(0,0,0,.8);border-radius:0 0 3px 3px}.vditor-textarea[disabled]{opacity:.3;cursor:not-allowed}.vditor-textarea:focus{background-color:#fff}.vditor-preview{flex:1;background-color:#f3f3f3;overflow:auto;padding:10px;box-shadow:inset 1px 0 #fff;box-sizing:border-box;border-radius:0 0 3px 0}.vditor-preview::-webkit-scrollbar{display:none}.vditor-counter{padding:0 3px;position:absolute;bottom:10px;right:20px;color:rgba(0,0,0,.8);background-color:hsla(0,0%,100%,.6);border-radius:3px;font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vditor-counter--error{color:#d23f31;background-color:rgba(210,63,49,.1)}.vditor-resize{padding:1px 0;border-radius:5px;cursor:row-resize;transition:all .15s ease-in-out;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#f3f3f3}.vditor-resize:hover{background-color:#2c2c2c}.vditor-resize:hover svg{color:#fff}.vditor-resize svg{fill:currentColor;stroke-width:0;stroke:currentColor;width:13px;height:3px;display:block;margin:0 auto;color:#b9b9b9}.vditor-upload{opacity:0;position:absolute;width:100%;height:5px;left:0;top:-3px;border-radius:3px;overflow:hidden;transition:all .15s ease-in-out}.vditor-upload--tip{height:20px;font-size:12px;line-height:20px;color:#fff;opacity:1!important}.vditor-upload--tip .vditor-upload__close{position:absolute;right:5px;top:0;cursor:pointer;display:block}.vditor-upload--tip .vditor-upload__progress{padding:0 5px}.vditor-upload__close{display:none}.vditor-upload__progress{height:100%;background-color:rgba(44,44,44,.8);transition:all .15s ease-in-out}.vditor-hint{background-color:#fff;position:absolute;box-shadow:0 1px 2px rgba(0,0,0,.2);border-radius:3px;padding:5px 0;z-index:1;line-height:20px;list-style:none;color:rgba(0,0,0,.8);font-size:12px;margin:0;max-width:200px;min-width:80px;display:none}.vditor-hint li{cursor:pointer;padding:3px 10px;border-bottom:1px solid #fff;line-height:20px}.vditor-hint li:last-child{border-bottom:0}.vditor-hint--current,.vditor-hint li:hover{background-color:#2c2c2c;color:#fff}.vditor-hint__emoji{font-size:16px;float:left;margin-right:3px}.vditor-hint img{height:20px;width:20px;float:left;margin-right:3px}
\ No newline at end of file
(window.webpackJsonpVditor=window.webpackJsonpVditor||[]).push([[1],{25:function(e,n){},26:function(e,n,t){"use strict";function r(e,n){return Array(n+1).join(e)}t.r(n);var i=["address","article","aside","audio","blockquote","body","canvas","center","dd","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frameset","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","isindex","li","main","menu","nav","noframes","noscript","ol","output","p","pre","section","table","tbody","td","tfoot","th","thead","tr","ul"];function o(e){return-1!==i.indexOf(e.nodeName.toLowerCase())}var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function l(e){return-1!==a.indexOf(e.nodeName.toLowerCase())}var u=a.join();var c={};function s(e){for(var n in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[n])}function f(e,n,t){for(var r=0;r<e.length;r++){var i=e[r];if(d(i,n,t))return i}}function d(e,n,t){var r=e.filter;if("string"==typeof r){if(r===n.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(n.nodeName.toLowerCase())>-1)return!0}else{if("function"!=typeof r)throw new TypeError("`filter` needs to be a string, array, or function");if(r.call(e,n,t))return!0}}function p(e){var n=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),n}function h(e,n,t){return e&&e.parentNode===n||t(n)?n.nextSibling||n.parentNode:n.firstChild||n.nextSibling||n.parentNode}c.paragraph={filter:"p",replacement:function(e){return"\n\n"+e+"\n\n"}},c.lineBreak={filter:"br",replacement:function(e,n,t){return t.br+"\n"}},c.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,n,t){var i=Number(n.nodeName.charAt(1));return"setext"===t.headingStyle&&i<3?"\n\n"+e+"\n"+r(1===i?"=":"-",e.length)+"\n\n":"\n\n"+r("#",i)+" "+e+"\n\n"}},c.blockquote={filter:"blockquote",replacement:function(e){return"\n\n"+(e=(e=e.replace(/^\n+|\n+$/g,"")).replace(/^/gm,"> "))+"\n\n"}},c.list={filter:["ul","ol"],replacement:function(e,n){var t=n.parentNode;return"LI"===t.nodeName&&t.lastElementChild===n?"\n"+e:"\n\n"+e+"\n\n"}},c.listItem={filter:"li",replacement:function(e,n,t){e=e.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n/gm,"\n ");var r=t.bulletListMarker+" ",i=n.parentNode;if("OL"===i.nodeName){var o=i.getAttribute("start"),a=Array.prototype.indexOf.call(i.children,n);r=(o?Number(o)+a:a+1)+". "}return r+e+(n.nextSibling&&!/\n$/.test(e)?"\n":"")}},c.indentedCodeBlock={filter:function(e,n){return"indented"===n.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,n,t){return"\n\n "+n.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}},c.fencedCodeBlock={filter:function(e,n){return"fenced"===n.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,n,t){var r=((n.firstChild.className||"").match(/language-(\S+)/)||[null,""])[1];return"\n\n"+t.fence+r+"\n"+n.firstChild.textContent+"\n"+t.fence+"\n\n"}},c.horizontalRule={filter:"hr",replacement:function(e,n,t){return"\n\n"+t.hr+"\n\n"}},c.inlineLink={filter:function(e,n){return"inlined"===n.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,n){return"["+e+"]("+n.getAttribute("href")+(n.title?' "'+n.title+'"':"")+")"}},c.referenceLink={filter:function(e,n){return"referenced"===n.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,n,t){var r,i,o=n.getAttribute("href"),a=n.title?' "'+n.title+'"':"";switch(t.linkReferenceStyle){case"collapsed":r="["+e+"][]",i="["+e+"]: "+o+a;break;case"shortcut":r="["+e+"]",i="["+e+"]: "+o+a;break;default:var l=this.references.length+1;r="["+e+"]["+l+"]",i="["+l+"]: "+o+a}return this.references.push(i),r},references:[],append:function(e){var n="";return this.references.length&&(n="\n\n"+this.references.join("\n")+"\n\n",this.references=[]),n}},c.emphasis={filter:["em","i"],replacement:function(e,n,t){return e.trim()?t.emDelimiter+e+t.emDelimiter:""}},c.strong={filter:["strong","b"],replacement:function(e,n,t){return e.trim()?t.strongDelimiter+e+t.strongDelimiter:""}},c.code={filter:function(e){var n=e.previousSibling||e.nextSibling,t="PRE"===e.parentNode.nodeName&&!n;return"CODE"===e.nodeName&&!t},replacement:function(e){if(!e.trim())return"";var n="`",t="",r="",i=e.match(/`+/gm);if(i)for(/^`/.test(e)&&(t=" "),/`$/.test(e)&&(r=" ");-1!==i.indexOf(n);)n+="`";return n+t+e+r+n}},c.image={filter:"img",replacement:function(e,n){var t=n.alt||"",r=n.getAttribute("src")||"",i=n.title||"";return r?"!["+t+"]("+r+(i?' "'+i+'"':"")+")":""}},s.prototype={add:function(e,n){this.array.unshift(n)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){return e.isBlank?this.blankRule:(n=f(this.array,e,this.options))?n:(n=f(this._keep,e,this.options))?n:(n=f(this._remove,e,this.options))?n:this.defaultRule;var n},forEach:function(e){for(var n=0;n<this.array.length;n++)e(this.array[n],n)}};var m="undefined"!=typeof window?window:{};var g,y,v,k=function(){var e=m.DOMParser,n=!1;try{(new e).parseFromString("","text/html")&&(n=!0)}catch(e){}return n}()?m.DOMParser:(g=function(){},y=t(25).JSDOM,g.prototype.parseFromString=function(e){return new y(e).window.document},g);function b(e){var n;"string"==typeof e?n=(v=v||new k).parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html").getElementById("turndown-root"):n=e.cloneNode(!0);return function(e){var n=e.element,t=e.isBlock,r=e.isVoid,i=e.isPre||function(e){return"PRE"===e.nodeName};if(n.firstChild&&!i(n)){for(var o=null,a=!1,l=null,u=h(l,n,i);u!==n;){if(3===u.nodeType||4===u.nodeType){var c=u.data.replace(/[ \r\n\t]+/g," ");if(o&&!/ $/.test(o.data)||a||" "!==c[0]||(c=c.substr(1)),!c){u=p(u);continue}u.data=c,o=u}else{if(1!==u.nodeType){u=p(u);continue}t(u)||"BR"===u.nodeName?(o&&(o.data=o.data.replace(/ $/,"")),o=null,a=!1):r(u)&&(o=null,a=!0)}var s=h(l,u,i);l=u,u=s}o&&(o.data=o.data.replace(/ $/,""),o.data||p(o))}}({element:n,isBlock:o,isVoid:l}),n}function w(e){return e.isBlock=o(e),e.isCode="code"===e.nodeName.toLowerCase()||e.parentNode.isCode,e.isBlank=function(e){return-1===["A","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"].indexOf(e.nodeName)&&/^\s*$/i.test(e.textContent)&&!l(e)&&!function(e){return e.querySelector&&e.querySelector(u)}(e)}(e),e.flankingWhitespace=function(e){var n="",t="";if(!e.isBlock){var r=/^[ \r\n\t]/.test(e.textContent),i=/[ \r\n\t]$/.test(e.textContent);r&&!N("left",e)&&(n=" "),i&&!N("right",e)&&(t=" ")}return{leading:n,trailing:t}}(e),e}function N(e,n){var t,r,i;return"left"===e?(t=n.previousSibling,r=/ $/):(t=n.nextSibling,r=/^ /),t&&(3===t.nodeType?i=r.test(t.nodeValue):1!==t.nodeType||o(t)||(i=r.test(t.textContent))),i}var C=Array.prototype.reduce,S=/^\n*/,x=/\n*$/,R=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function A(e){if(!(this instanceof A))return new A(e);var n={rules:c,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",blankReplacement:function(e,n){return n.isBlock?"\n\n":""},keepReplacement:function(e,n){return n.isBlock?"\n\n"+n.outerHTML+"\n\n":n.outerHTML},defaultReplacement:function(e,n){return n.isBlock?"\n\n"+e+"\n\n":e}};this.options=function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}return e}({},n,e),this.rules=new s(this.options)}function T(e){var n=this;return C.call(e.childNodes,function(e,t){var r="";return 3===(t=new w(t)).nodeType?r=t.isCode?t.nodeValue:n.escape(t.nodeValue):1===t.nodeType&&(r=function(e){var n=this.rules.forNode(e),t=T.call(this,e),r=e.flankingWhitespace;(r.leading||r.trailing)&&(t=t.trim());return r.leading+n.replacement(t,e,this.options)+r.trailing}.call(n,t)),B(e,r)},"")}function B(e,n){var t,r,i,o=(t=n,r=[e.match(x)[0],t.match(S)[0]].sort(),(i=r[r.length-1]).length<2?i:"\n\n");return(e=e.replace(x,""))+o+(n=n.replace(S,""))}A.prototype={turndown:function(e){if(!function(e){return null!=e&&("string"==typeof e||e.nodeType&&(1===e.nodeType||9===e.nodeType||11===e.nodeType))}(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(""===e)return"";var n=T.call(this,new b(e));return function(e){var n=this;return this.rules.forEach(function(t){"function"==typeof t.append&&(e=B(e,t.append(n.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}.call(this,n)},use:function(e){if(Array.isArray(e))for(var n=0;n<e.length;n++)this.use(e[n]);else{if("function"!=typeof e)throw new TypeError("plugin must be a Function or an Array of Functions");e(this)}return this},addRule:function(e,n){return this.rules.add(e,n),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return R.reduce(function(e,n){return e.replace(n[0],n[1])},e)}},n.default=A}}]);
\ No newline at end of file
......@@ -103,10 +103,6 @@ $.extend(Page.prototype, {
var that = this
if (typeof Vditor === 'undefined') {
$('head').
append(
$('<link rel=\'stylesheet\' href=\'' + latkeConfig.staticServePath + '/js/lib/vditor-0.2.5/index.classic.css\'>'))
$.ajax({
method: 'GET',
url: latkeConfig.staticServePath + '/js/lib/vditor-0.2.5/index.min.js',
......
This diff is collapsed.
Subproject commit 3a5132b6ba245f04deab73e914c4de78df1cce07
Subproject commit 34635fd9f5c77416fd99de336203d4616dfb8560
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment