feat: upgrade marked to 0.5.x, fixed #645, close #644 (#662)

This commit is contained in:
cinwell.li 2018-10-31 20:34:56 +08:00 committed by GitHub
parent 1ce37bdc2e
commit a39b214733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 86 deletions

104
package-lock.json generated
View File

@ -32,7 +32,7 @@
},
"acorn-jsx": {
"version": "3.0.1",
"resolved": "http://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz",
"integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=",
"dev": true,
"requires": {
@ -41,7 +41,7 @@
"dependencies": {
"acorn": {
"version": "3.3.0",
"resolved": "http://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
"integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=",
"dev": true
}
@ -647,7 +647,7 @@
},
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": {
"ansi-styles": "^2.2.1",
@ -833,7 +833,7 @@
},
"color": {
"version": "0.11.4",
"resolved": "http://registry.npmjs.org/color/-/color-0.11.4.tgz",
"resolved": "https://registry.npmjs.org/color/-/color-0.11.4.tgz",
"integrity": "sha1-bXtcdPtl6EHNSHkq0e1eB7kE12Q=",
"dev": true,
"requires": {
@ -953,7 +953,7 @@
"dependencies": {
"debug": {
"version": "2.2.0",
"resolved": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
"dev": true,
"requires": {
@ -962,7 +962,7 @@
},
"ms": {
"version": "0.7.1",
"resolved": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=",
"dev": true
}
@ -1311,7 +1311,7 @@
},
"css-color-names": {
"version": "0.0.4",
"resolved": "http://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
"resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
"integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=",
"dev": true
},
@ -1323,7 +1323,7 @@
},
"cssnano": {
"version": "3.10.0",
"resolved": "http://registry.npmjs.org/cssnano/-/cssnano-3.10.0.tgz",
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-3.10.0.tgz",
"integrity": "sha1-Tzj2zqK5sX+gFJDyPx3GjqZcHDg=",
"dev": true,
"requires": {
@ -1637,7 +1637,7 @@
},
"duplexer": {
"version": "0.1.1",
"resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
"integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
"dev": true
},
@ -1859,7 +1859,7 @@
},
"eslint-config-xo": {
"version": "0.20.1",
"resolved": "http://registry.npmjs.org/eslint-config-xo/-/eslint-config-xo-0.20.1.tgz",
"resolved": "https://registry.npmjs.org/eslint-config-xo/-/eslint-config-xo-0.20.1.tgz",
"integrity": "sha512-bhDRezvlbYNZn8SHv0WE8aPsdPtH3sq1IU2SznyOtmRwi6e/XQkzs+Kaw1hA9Pz4xmkG796egIsFY2RD6fwUeQ==",
"dev": true
},
@ -2247,7 +2247,7 @@
},
"finalhandler": {
"version": "0.5.1",
"resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-0.5.1.tgz",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-0.5.1.tgz",
"integrity": "sha1-LEANjUUwk1vCMlScX6OF7Afeb80=",
"dev": true,
"requires": {
@ -2260,7 +2260,7 @@
"dependencies": {
"debug": {
"version": "2.2.0",
"resolved": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
"dev": true,
"requires": {
@ -2269,7 +2269,7 @@
},
"ms": {
"version": "0.7.1",
"resolved": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=",
"dev": true
}
@ -3049,7 +3049,7 @@
},
"get-stream": {
"version": "3.0.0",
"resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
"dev": true
},
@ -3219,7 +3219,7 @@
},
"got": {
"version": "6.7.1",
"resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz",
"resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz",
"integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=",
"dev": true,
"requires": {
@ -3516,7 +3516,7 @@
},
"is-builtin-module": {
"version": "1.0.0",
"resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
"dev": true,
"requires": {
@ -3661,7 +3661,7 @@
},
"is-obj": {
"version": "1.0.1",
"resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
"dev": true
},
@ -4388,9 +4388,9 @@
}
},
"marked": {
"version": "0.3.19",
"resolved": "http://registry.npmjs.org/marked/-/marked-0.3.19.tgz",
"integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg=="
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/marked/-/marked-0.5.1.tgz",
"integrity": "sha512-iUkBZegCZou4AdwbKTwSW/lNDcz5OuRSl3qdcl31Ia0B2QPG0Jn+tKblh/9/eP9/6+4h27vpoh8wel/vQOV0vw=="
},
"math-expression-evaluator": {
"version": "1.2.17",
@ -4406,7 +4406,7 @@
},
"medium-zoom": {
"version": "0.4.0",
"resolved": "http://registry.npmjs.org/medium-zoom/-/medium-zoom-0.4.0.tgz",
"resolved": "https://registry.npmjs.org/medium-zoom/-/medium-zoom-0.4.0.tgz",
"integrity": "sha512-0z7yMfd6I1BTCAa8QaR4cp5AqDkQD571GzhHIbbfefKEssGLSvs+4Xai/itOAncm4FBlF5gUoMQ22yW9/f8Sig=="
},
"mem": {
@ -4558,7 +4558,7 @@
},
"mkdirp": {
"version": "0.5.1",
"resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
@ -4675,7 +4675,7 @@
},
"node-fetch": {
"version": "1.6.3",
"resolved": "http://registry.npmjs.org/node-fetch/-/node-fetch-1.6.3.tgz",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.6.3.tgz",
"integrity": "sha1-3CNO3WSJmC1Y6PDbT2lQKavNjAQ=",
"requires": {
"encoding": "^0.1.11",
@ -4942,7 +4942,7 @@
},
"opn": {
"version": "4.0.2",
"resolved": "http://registry.npmjs.org/opn/-/opn-4.0.2.tgz",
"resolved": "https://registry.npmjs.org/opn/-/opn-4.0.2.tgz",
"integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=",
"requires": {
"object-assign": "^4.0.1",
@ -5185,7 +5185,7 @@
},
"pause-stream": {
"version": "0.0.11",
"resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
"resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
"integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=",
"dev": true,
"requires": {
@ -5256,7 +5256,7 @@
},
"postcss-calc": {
"version": "5.3.1",
"resolved": "http://registry.npmjs.org/postcss-calc/-/postcss-calc-5.3.1.tgz",
"resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-5.3.1.tgz",
"integrity": "sha1-d7rnypKK2FcW4v2kLyYb98HWW14=",
"dev": true,
"requires": {
@ -5357,7 +5357,7 @@
},
"postcss-discard-comments": {
"version": "2.0.4",
"resolved": "http://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-2.0.4.tgz",
"resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-2.0.4.tgz",
"integrity": "sha1-vv6J+v1bPazlzM5Rt2uBUUvgDj0=",
"dev": true,
"requires": {
@ -5421,7 +5421,7 @@
},
"postcss-discard-empty": {
"version": "2.1.0",
"resolved": "http://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-2.1.0.tgz",
"resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-2.1.0.tgz",
"integrity": "sha1-0rS9nVztXr2Nyt52QMfXzX9PkrU=",
"dev": true,
"requires": {
@ -5453,7 +5453,7 @@
},
"postcss-discard-overridden": {
"version": "0.1.1",
"resolved": "http://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-0.1.1.tgz",
"resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-0.1.1.tgz",
"integrity": "sha1-ix6vVU9ob7KIzYdMVWZ7CqNmjVg=",
"dev": true,
"requires": {
@ -5485,7 +5485,7 @@
},
"postcss-discard-unused": {
"version": "2.2.3",
"resolved": "http://registry.npmjs.org/postcss-discard-unused/-/postcss-discard-unused-2.2.3.tgz",
"resolved": "https://registry.npmjs.org/postcss-discard-unused/-/postcss-discard-unused-2.2.3.tgz",
"integrity": "sha1-vOMLLMWR/8Y0Mitfs0ZLbZNPRDM=",
"dev": true,
"requires": {
@ -5550,7 +5550,7 @@
},
"postcss-merge-idents": {
"version": "2.1.7",
"resolved": "http://registry.npmjs.org/postcss-merge-idents/-/postcss-merge-idents-2.1.7.tgz",
"resolved": "https://registry.npmjs.org/postcss-merge-idents/-/postcss-merge-idents-2.1.7.tgz",
"integrity": "sha1-TFUwMTwI4dWzu/PSu8dH4njuonA=",
"dev": true,
"requires": {
@ -5668,7 +5668,7 @@
},
"postcss-minify-font-values": {
"version": "1.0.5",
"resolved": "http://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-1.0.5.tgz",
"resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-1.0.5.tgz",
"integrity": "sha1-S1jttWZB66fIR0qzUmyv17vey2k=",
"dev": true,
"requires": {
@ -5702,7 +5702,7 @@
},
"postcss-minify-gradients": {
"version": "1.0.5",
"resolved": "http://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-1.0.5.tgz",
"resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-1.0.5.tgz",
"integrity": "sha1-Xb2hE3NwP4PPtKPqOIHY11/15uE=",
"dev": true,
"requires": {
@ -5735,7 +5735,7 @@
},
"postcss-minify-params": {
"version": "1.2.2",
"resolved": "http://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-1.2.2.tgz",
"resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-1.2.2.tgz",
"integrity": "sha1-rSzgcTc7lDs9kwo/pZo1jCjW8fM=",
"dev": true,
"requires": {
@ -5770,7 +5770,7 @@
},
"postcss-minify-selectors": {
"version": "2.1.1",
"resolved": "http://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-2.1.1.tgz",
"resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-2.1.1.tgz",
"integrity": "sha1-ssapjAByz5G5MtGkllCBFDEXNb8=",
"dev": true,
"requires": {
@ -5805,7 +5805,7 @@
},
"postcss-normalize-charset": {
"version": "1.1.1",
"resolved": "http://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-1.1.1.tgz",
"integrity": "sha1-757nEhLX/nWceO0WL2HtYrXLk/E=",
"dev": true,
"requires": {
@ -5837,7 +5837,7 @@
},
"postcss-normalize-url": {
"version": "3.0.8",
"resolved": "http://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-3.0.8.tgz",
"resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-3.0.8.tgz",
"integrity": "sha1-EI90s/L82viRov+j6kWSJ5/HgiI=",
"dev": true,
"requires": {
@ -5905,7 +5905,7 @@
},
"postcss-reduce-idents": {
"version": "2.4.0",
"resolved": "http://registry.npmjs.org/postcss-reduce-idents/-/postcss-reduce-idents-2.4.0.tgz",
"resolved": "https://registry.npmjs.org/postcss-reduce-idents/-/postcss-reduce-idents-2.4.0.tgz",
"integrity": "sha1-wsbSDMlYKE9qv75j92Cb9AkFmtM=",
"dev": true,
"requires": {
@ -5938,7 +5938,7 @@
},
"postcss-reduce-initial": {
"version": "1.0.1",
"resolved": "http://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-1.0.1.tgz",
"integrity": "sha1-aPgGlfBF0IJjqHmtJA343WT2ROo=",
"dev": true,
"requires": {
@ -5970,7 +5970,7 @@
},
"postcss-reduce-transforms": {
"version": "1.0.4",
"resolved": "http://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-1.0.4.tgz",
"resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-1.0.4.tgz",
"integrity": "sha1-/3b02CEkN7McKYpC0uFEQCV3GuE=",
"dev": true,
"requires": {
@ -6015,7 +6015,7 @@
},
"postcss-svgo": {
"version": "2.1.6",
"resolved": "http://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.6.tgz",
"resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.6.tgz",
"integrity": "sha1-tt8YqmE7Zm4TPwittSGcJoSsEI0=",
"dev": true,
"requires": {
@ -6050,7 +6050,7 @@
},
"postcss-unique-selectors": {
"version": "2.0.2",
"resolved": "http://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-2.0.2.tgz",
"resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-2.0.2.tgz",
"integrity": "sha1-mB1X0p3csz57Hf4f1DuGSfkzyh0=",
"dev": true,
"requires": {
@ -6090,7 +6090,7 @@
},
"postcss-zindex": {
"version": "2.2.0",
"resolved": "http://registry.npmjs.org/postcss-zindex/-/postcss-zindex-2.2.0.tgz",
"resolved": "https://registry.npmjs.org/postcss-zindex/-/postcss-zindex-2.2.0.tgz",
"integrity": "sha1-0hCd3AVbka9n/EyzsCWUZjnSryI=",
"dev": true,
"requires": {
@ -6397,7 +6397,7 @@
},
"reduce-css-calc": {
"version": "1.3.0",
"resolved": "http://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz",
"resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz",
"integrity": "sha1-dHyRTgSWFKTJz7umKYca0dKSdxY=",
"dev": true,
"requires": {
@ -7084,7 +7084,7 @@
},
"rollup-pluginutils": {
"version": "1.5.2",
"resolved": "http://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
"integrity": "sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=",
"dev": true,
"requires": {
@ -7585,7 +7585,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "^2.0.0"
@ -7630,7 +7630,7 @@
"dependencies": {
"minimist": {
"version": "0.1.0",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.1.0.tgz",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.1.0.tgz",
"integrity": "sha1-md9lelJXTCHJBXSX33QnkLK0wN4=",
"dev": true
}
@ -7666,7 +7666,7 @@
},
"sax": {
"version": "0.5.8",
"resolved": "http://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
"resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
"integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=",
"dev": true
},
@ -7804,7 +7804,7 @@
},
"through": {
"version": "2.3.8",
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"through2": {
@ -8086,7 +8086,7 @@
},
"uuid": {
"version": "2.0.3",
"resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz",
"integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=",
"dev": true
},
@ -8181,7 +8181,7 @@
},
"wrap-ansi": {
"version": "2.1.0",
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"dev": true,
"requires": {
@ -8324,7 +8324,7 @@
"dependencies": {
"load-json-file": {
"version": "2.0.0",
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
"integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
"dev": true,
"requires": {

View File

@ -42,7 +42,7 @@
"postinstall": "opencollective postinstall"
},
"dependencies": {
"marked": "^0.3.12",
"marked": "^0.5.1",
"medium-zoom": "^0.4.0",
"opencollective": "^1.0.3",
"prismjs": "^1.9.0",

View File

@ -14,6 +14,7 @@ export function getAndRemoveConfig(str = '') {
if (str) {
str = str
.replace(/^'|'$/, '')
.replace(/:([\w-]+)=?([\w-]+)?/g, (m, key, value) => {
config[key] = (value && value.replace(/"/g, '')) || true
return ''
@ -37,17 +38,17 @@ const compileMedia = {
},
iframe(url, title) {
return {
code: `<iframe src="${url}" ${title || 'width=100% height=400'}></iframe>`
html: `<iframe src="${url}" ${title || 'width=100% height=400'}></iframe>`
}
},
video(url, title) {
return {
code: `<video src="${url}" ${title || 'controls'}>Not Support</video>`
html: `<video src="${url}" ${title || 'controls'}>Not Support</video>`
}
},
audio(url, title) {
return {
code: `<audio src="${url}" ${title || 'controls'}>Not Support</audio>`
html: `<audio src="${url}" ${title || 'controls'}>Not Support</audio>`
}
},
code(url, title) {
@ -296,18 +297,6 @@ export class Compiler {
return `<img src="${url}"data-origin="${href}" alt="${text}"${attrs}>`
}
const CHECKED_RE = /^\[([ x])\] +/
origin.listitem = renderer.listitem = function (text) {
const checked = CHECKED_RE.exec(text)
if (checked) {
text = text.replace(
CHECKED_RE,
`<input type="checkbox" ${checked[1] === 'x' ? 'checked' : ''} />`
)
}
return `<li${checked ? ` class="task-list-item"` : ''}>${text}</li>\n`
}
renderer.origin = origin
return renderer

View File

@ -28,7 +28,12 @@ function walkFetchEmbed({embedTokens, compile, fetch}, cb) {
'\n```\n'
)
} else if (token.embed.type === 'mermaid') {
embedToken = [{type: 'html', text: `<div class="mermaid">\n${text}\n</div>`}]
embedToken = [
{type: 'html', text: `<div class="mermaid">\n${text}\n</div>`}
]
embedToken.links = {}
} else {
embedToken = [{type: 'html', text: text}]
embedToken.links = {}
}
}
@ -39,10 +44,14 @@ function walkFetchEmbed({embedTokens, compile, fetch}, cb) {
}
})(token)
if (process.env.SSR) {
fetch(token.embed.url).then(next)
if (token.embed.url) {
if (process.env.SSR) {
fetch(token.embed.url).then(next)
} else {
get(token.embed.url).then(next)
}
} else {
get(token.embed.url).then(next)
next(token.embed.html)
}
}
}
@ -67,16 +76,10 @@ export function prerenderEmbed({compiler, raw = '', fetch}, done) {
const embed = compiler.compileEmbed(href, title)
if (embed) {
if (embed.type === 'markdown' ||
embed.type === 'code' ||
embed.type === 'mermaid'
) {
embedTokens.push({
index,
embed
})
}
return embed.code
embedTokens.push({
index,
embed
})
}
return src

View File

@ -74,11 +74,8 @@ kbd
padding 3px 5px
vertical-align middle
.task-list-item
list-style-type none
li input[type='checkbox']
margin 0 0.2em 0.25em -1.6em
margin 0 0.2em 0.25em 0
vertical-align middle
/* navbar */