diff --git a/src/code/colorful.js b/src/code/colorful.js index 0c815be..05ef57f 100644 --- a/src/code/colorful.js +++ b/src/code/colorful.js @@ -20,8 +20,9 @@ const BUILDIN2 = /\b(Object|String|Array|Boolean|Number|Function|class|Promise|Map|Set|WeakMap|WeakSet|URL)\b/g const STR = /(['"`])(.*?)(?$1[/key]') .replace(KEYWOWRD2, ' [key]$1[/key] ') .replace(KEYWOWRD3, '[key]$1[/key]') .replace(BUILDIN1, '[num]$1[/num]') @@ -67,7 +68,7 @@ function parseJs(code) { return `[cm]${pun}[/cm][str]${str}[/str][cm]${pun}[/cm]` }) - .replace(CM, (m, str) => { + .replace(CM1, (m, str) => { str = str .replace(/\[(\w+)\](.*?)\[\/\1\]/g, '$2') .replace(/&/g, '&') @@ -75,6 +76,16 @@ function parseJs(code) { .replace(/>/g, '>') return `[cm]${str}[/cm]` }) + .replace(CM2, (m, str) => { + str = str + .replace(/\[(\w+)\](.*?)\[\/\1\]/g, '$2') + .replace(/&/g, '&') + .replace(//g, '>') + + str = `/*${str}*/`.split('\n').map(s => `[cm]${s}[/cm]`) + return str.join('\n') + }) } function rebuild(code) { diff --git a/src/code/index.wc b/src/code/index.wc index c37953c..fb47a62 100644 --- a/src/code/index.wc +++ b/src/code/index.wc @@ -80,7 +80,6 @@ .scroll { overflow: hidden; flex: 1; - padding: 5px 0 0; line-height: 20px; font-size: 14px; color: var(--color-dark-1);