From 27afa2c5c5389da0e718d543949c75020dacc2c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Fri, 28 May 2021 18:54:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/code/colorful.js | 10 +++++++--- src/css/reset-basic.css | 16 ++++++++-------- src/layer/index.wc | 41 +++++++++++++++++++++-------------------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/code/colorful.js b/src/code/colorful.js index 171c827..01b5348 100644 --- a/src/code/colorful.js +++ b/src/code/colorful.js @@ -18,7 +18,7 @@ const BUILDIN2 = /\b(Object|String|Array|Boolean|Number|Function|class)\b/g const STR = /(['"`])(.*?)\1/g const NUM = /\b(\d+)\b/g const FN = /([\.\s])([a-zA-Z$][\da-zA-Z_]*)(\(.*?\))/g -const CM = /(?=\s)([ ]*\/\/.*)|(^\/\/.*)/g +const CM = /(?=\s)?([ ]*\/\/.*)|(^\/\/.*)/g const INLINE = { code: /`([^`]*?[^`\\\s])`/g, codeBlock: /^```(.*?)$/gm, @@ -46,9 +46,13 @@ function parseJs(code) { .replace(BUILDIN2, '[type]$1[/type]') .replace(NUM, '[num]$1[/num]') .replace(STR, (m, q, str) => { - return `[str]${q}${str.replace(/\[\/?num\]/g, '')}${q}[/str]` + str = str.replace(/\[(\w+)\](.*?)\[\/\1\]/g, '$2') + return `[str]${q}${str}${q}[/str]` + }) + .replace(CM, (m, str) => { + str = str.replace(/\[(\w+)\](.*?)\[\/\1\]/g, '$2') + return `[cm]${str}[/cm]` }) - .replace(CM, '[cm]$1[/cm]') } function rebuild(code) { diff --git a/src/css/reset-basic.css b/src/css/reset-basic.css index 2f7883b..9f56c98 100644 --- a/src/css/reset-basic.css +++ b/src/css/reset-basic.css @@ -40,42 +40,42 @@ code, pre, samp {font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; :root { /* primary */ - --color-teal-a: rgba(72, 201, 176, 0.5); + --color-teal-a: rgba(72, 201, 176, 0.35); --color-teal-1: rgb(72, 201, 176); --color-teal-2: rgb(26, 188, 156); --color-teal-3: rgb(22, 160, 133); /* success */ - --color-green-a: rgba(88, 214, 141, 0.5); + --color-green-a: rgba(88, 214, 141, 0.35); --color-green-1: rgb(88, 214, 141); --color-green-2: rgb(46, 204, 113); --color-green-3: rgb(39, 173, 96); /* info */ - --color-blue-a: rgba(100, 181, 246, 0.5); + --color-blue-a: rgba(100, 181, 246, 0.35); --color-blue-1: rgb(100, 181, 246); --color-blue-2: rgb(66, 165, 245); --color-blue-3: rgb(33, 150, 243); /* danger */ - --color-red-a: rgba(255, 107, 129, 0.5); + --color-red-a: rgba(255, 107, 129, 0.35); --color-red-1: rgb(255, 107, 129); --color-red-2: rgb(255, 71, 87); --color-red-3: rgb(230, 52, 67); /* warning */ - --color-orange-a: rgba(244, 211, 19, 0.5); + --color-orange-a: rgba(244, 211, 19, 0.35); --color-orange-1: rgb(244, 211, 19); --color-orange-2: rgb(241, 196, 15); --color-orange-3: rgb(205, 167, 13); /* default1 */ - --color-plain-a: rgba(150, 204, 248, 0.5); + --color-plain-a: rgba(150, 204, 248, 0.35); --color-plain-1: rgb(242, 245, 252); --color-plain-2: rgb(232, 235, 244); --color-plain-3: rgb(218, 225, 233); /* default2 */ - --color-grey-a: rgba(206, 214, 224, 0.5); + --color-grey-a: rgba(206, 214, 224, 0.35); --color-grey-1: rgb(206, 214, 224); --color-grey-2: rgb(164, 176, 190); --color-grey-3: rgb(134, 144, 155); /* inverse */ - --color-dark-a: rgba(87, 96, 111, 0.5); + --color-dark-a: rgba(87, 96, 111, 0.35); --color-dark-1: rgb(87, 96, 111); --color-dark-2: rgb(52, 73, 94); --color-dark-3: rgb(44, 62, 80); diff --git a/src/layer/index.wc b/src/layer/index.wc index febc102..0f4b546 100644 --- a/src/layer/index.wc +++ b/src/layer/index.wc @@ -5,6 +5,7 @@
+