From e753c2a2f5fc5db7666549bae505ff46323f5e16 Mon Sep 17 00:00:00 2001 From: Tevin Date: Sat, 29 Jul 2017 16:34:46 +0800 Subject: [PATCH] =?UTF-8?q?markdown=20=E5=9F=BA=E7=A1=80=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E6=89=A9=E5=B1=95=EF=BC=8C=E5=85=81=E8=AE=B8=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E9=AB=98=E4=BA=AE=E6=A0=87=E7=AD=BE=E5=AF=B9=E6=96=87=E5=AD=97?= =?UTF-8?q?=E9=A3=98=E7=BA=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/amWiki.css | 1 + files/amWiki.docs.js | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/files/amWiki.css b/files/amWiki.css index 55878c3..333eb8b 100644 --- a/files/amWiki.css +++ b/files/amWiki.css @@ -32,6 +32,7 @@ .markdown-body .lang-off-js-comment:hover i{color:#999;} .markdown-body .lang-off-js-comment.on{display:block;color:#333;background:#ccc;} .markdown-body .lang-off-js-comment.on i{color:#f00;} +.markdown-body mark{color:#e61e1e;background:transparent;} /* ---------- base ---------- */ html{height:100%;} diff --git a/files/amWiki.docs.js b/files/amWiki.docs.js index 4b42816..1cb5b1d 100644 --- a/files/amWiki.docs.js +++ b/files/amWiki.docs.js @@ -142,7 +142,7 @@ * @returns {String} * @private */ - Docs.prototype._createFootnote = function (text) { + Docs.prototype._setFootnote = function (text) { var footnotes = []; var noteReg = /\[\^([ a-zA-Z\d]+)]/g; var footReg = /\[\^([ a-zA-Z\d]+)]: ?([\S\s]+?)(?=\[\^(?:[ a-zA-Z\d]+)]|\n\n|$)/g; @@ -233,7 +233,7 @@ var chart = flowchart.parse(code); chart.drawSVG(id, { 'line-width': 1.3, - 'line-length': 55, + 'line-length': 56, 'line-color': '#666', 'text-margin': 10, 'font-size': 12, @@ -257,7 +257,7 @@ * @returns {String} * @private */ - Docs.prototype._resizeImg = function (html) { + Docs.prototype._setImgResize = function (html) { return html.replace(/' + s1 + ''; + }); + }; + /** * 编码 url * 由于服务器可能存在 GBK 或 UTF-8 两种编码,中文路径编码不对需要切换才能访问 @@ -301,7 +307,7 @@ Docs.prototype._encodeUrl = function (path, type) { var url = 'library/'; if (typeof AWConfig.libraryPrefix == 'string' && AWConfig.libraryPrefix.length > 0) { - url = AWConfig.libraryPrefix.replace(/\\/g, '/').replace(/[\\\/]?&/, '/'); + url = AWConfig.libraryPrefix.replace(/\\/g, '/').replace(/\/?&/, '/'); } var paths = []; //正常编码 @@ -340,15 +346,17 @@ var html = ''; this.cleanView(); //创建脚注 - content = this._createFootnote(content); + content = this._setFootnote(content); //编译 markdown html = marked(content); //创建目录标记,和悬浮窗格式统一 html = html.replace(/\[(TOC|MENU)]/g, '
'); //自定义图片大小与对齐方式 - html = this._resizeImg(html); + html = this._setImgResize(html); //复选框 html = this._setCheckbox(html); + //文字飘红 + html = this._setRedText(html); //填充到页面 this.$e.view.html(html); //功能化代码块