From bfc50b8bb92aa3caed92be1dd379d00058672a3d Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Fri, 1 Nov 2019 16:33:58 +0800 Subject: [PATCH 1/2] Update markdownlint & webpack bundling Signed-off-by: Yukai Huang --- package.json | 2 +- public/js/lib/editor/markdown-lint/index.js | 5 +-- public/js/url.js | 1 - webpack.common.js | 9 ++--- yarn.lock | 39 +++++++++++++++++---- 5 files changed, 39 insertions(+), 17 deletions(-) delete mode 100644 public/js/url.js diff --git a/package.json b/package.json index 7507fa77..c4ed57a6 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "markdown-it-sub": "~1.0.0", "markdown-it-sup": "~1.0.0", "markdown-pdf": "~9.0.0", - "markdownlint": "^0.16.0", + "markdownlint": "^0.17.0", "mathjax": "~2.7.5", "mattermost-redux": "~5.13.0", "mermaid": "~8.2.3", diff --git a/public/js/lib/editor/markdown-lint/index.js b/public/js/lib/editor/markdown-lint/index.js index f8fbfc2e..0f018df1 100644 --- a/public/js/lib/editor/markdown-lint/index.js +++ b/public/js/lib/editor/markdown-lint/index.js @@ -1,5 +1,6 @@ /* global CodeMirror */ -import markdownlint from 'markdownlint' +window.markdownit = require('markdown-it') +require('script-loader!markdownlint') // load CM lint plugin explicitly import '@hackmd/codemirror/addon/lint/lint' @@ -36,7 +37,7 @@ import './lint.css' }) function lint (content) { - const { content: errors } = markdownlint.sync({ + const { content: errors } = window.markdownlint.sync({ strings: { content } diff --git a/public/js/url.js b/public/js/url.js deleted file mode 100644 index 22ed110b..00000000 --- a/public/js/url.js +++ /dev/null @@ -1 +0,0 @@ -exports.URL = window.URL diff --git a/webpack.common.js b/webpack.common.js index cba00716..2f4060dd 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -167,11 +167,7 @@ module.exports = { to: 'reveal.js/plugin' } ]), - new MiniCssExtractPlugin(), - new webpack.NormalModuleReplacementPlugin( - /^url$/, - path.resolve(__dirname, './public/js/url.js') - ) + new MiniCssExtractPlugin() ], entry: { @@ -385,7 +381,8 @@ module.exports = { 'emojify.js': path.join(__dirname, 'node_modules/@hackmd/emojify.js/dist/js/emojify-browser.min.js'), 'markdown-it': path.join(__dirname, 'node_modules/markdown-it/dist/markdown-it.js'), 'viz.js': path.join(__dirname, 'node_modules/viz.js/viz.js'), - 'viz.render.js': path.join(__dirname, 'node_modules/viz.js/full.render.js') + 'viz.render.js': path.join(__dirname, 'node_modules/viz.js/full.render.js'), + markdownlint: path.join(__dirname, 'node_modules/markdownlint/demo/markdownlint-browser.js') } }, diff --git a/yarn.lock b/yarn.lock index d545fe54..4901adea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1410,6 +1410,13 @@ after@0.8.2: resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" integrity sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8= +agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + dependencies: + es6-promisify "^5.0.0" + ajv-errors@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" @@ -4784,7 +4791,7 @@ entities@^1.1.1, entities@~1.1.1: resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== -entities@^2.0.0: +entities@^2.0.0, entities@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4" integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw== @@ -4884,6 +4891,13 @@ es6-promise@^4.0.3: resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== +es6-promisify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= + dependencies: + es6-promise "^4.0.3" + es6-set@~0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" @@ -7925,7 +7939,18 @@ markdown-it-sup@~1.0.0: resolved "https://registry.yarnpkg.com/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz#cb9c9ff91a5255ac08f3fd3d63286e15df0a1fc3" integrity sha1-y5yf+RpSVawI8/09YyhuFd8KH8M= -markdown-it@9.0.1, markdown-it@~9.0.1: +markdown-it@10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc" + integrity sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg== + dependencies: + argparse "^1.0.7" + entities "~2.0.0" + linkify-it "^2.0.0" + mdurl "^1.0.1" + uc.micro "^1.0.5" + +markdown-it@~9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-9.0.1.tgz#aafe363c43718720b6575fd10625cde6e4ff2d47" integrity sha512-XC9dMBHg28Xi7y5dPuLjM61upIGPJG8AiHNHYqIaXER2KNnn7eKnM5/sF0ImNnyoV224Ogn9b1Pck8VH4k0bxw== @@ -7956,12 +7981,12 @@ markdown-table@^1.1.0: resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.3.tgz#9fcb69bcfdb8717bfd0398c6ec2d93036ef8de60" integrity sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q== -markdownlint@^0.16.0: - version "0.16.0" - resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.16.0.tgz#69f73cc755a44231fbe5dc7c37a5909cedc0ac6e" - integrity sha512-Zo+iPezP3eM6lLhKepkUw+X98H44lipIdx4d6faaugfB0+7VuDB3R0hXmx7z9F1N3/ypn46oOFgAD9iF++Ie6A== +markdownlint@^0.17.0: + version "0.17.2" + resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.17.2.tgz#de0ab144fbf314fedadcb8a4ce0db9ea819f91a5" + integrity sha512-vsxopn0qEdm0P2XI3S9sVA+jvjKjR8lHZ+0FKlusth+1UK9tI29mRFkKeZPERmbWsMehJcogfMieBUkMgNEFkQ== dependencies: - markdown-it "9.0.1" + markdown-it "10.0.0" marked@~0.6.2: version "0.6.3" From f1586c57ddbce70924bafeee334bccd6eef54fa8 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Fri, 1 Nov 2019 16:47:41 +0800 Subject: [PATCH 2/2] Fix linter error Signed-off-by: Yukai Huang --- public/js/lib/editor/markdown-lint/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/js/lib/editor/markdown-lint/index.js b/public/js/lib/editor/markdown-lint/index.js index 0f018df1..1b92ece2 100644 --- a/public/js/lib/editor/markdown-lint/index.js +++ b/public/js/lib/editor/markdown-lint/index.js @@ -1,11 +1,13 @@ /* global CodeMirror */ -window.markdownit = require('markdown-it') -require('script-loader!markdownlint') // load CM lint plugin explicitly import '@hackmd/codemirror/addon/lint/lint' import './lint.css' +window.markdownit = require('markdown-it') +// eslint-disable-next-line +require('script-loader!markdownlint'); + (function (mod) { mod(CodeMirror) })(function (CodeMirror) {