diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..8f287b7 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/bin/mdstart.js" + } + ] +} diff --git a/client/src/index.js b/client/src/index.js index 68141a8..440dfa3 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -1,6 +1,6 @@ // default styles import 'normalize.css' -import 'katex/dist/katex.min.css' +import 'katex/dist/katex.css' import 'markdown-it-admon/styles/admonition.css' import 'confluencer/styles/status.css' import '../css/github.css' diff --git a/config.js b/config.js index d30eeb4..f3a0153 100644 --- a/config.js +++ b/config.js @@ -36,7 +36,7 @@ const config = { .use(require('markdown-it-abbr')) .use(require('markdown-it-admon')) .use(require('markdown-it-attrs')) - .use(require('markdown-it-emoji')) + .use(require('markdown-it-emoji').full) .use(require('markdown-it-deflist')) .use(require('markdown-it-footnote')) .use(require('markdown-it-highlightjs'), { diff --git a/lib/markd.js b/lib/markd.js index 91db3ac..84e7764 100644 --- a/lib/markd.js +++ b/lib/markd.js @@ -28,22 +28,22 @@ function preprocess (filename, data, config) { * @param {Callback} callback */ async function markdown (title, data, config) { - // set options for marked + // set options for markdown-it const options = Object.assign({}, config.markdownIt) - let _data = config.markdownItPlugins(md(options)) - .use(require('markdown-it-anchor'), { - // slugify: (id) => { - // return id - // .replace(/(&[lg]t;|[^\w]+)/g, '-') - // .toLowerCase() - // } - }) - .render(data) + const mdIt = md(options).use(require('markdown-it-anchor')) + // apply markdown plugins + config.markdownItPlugins(mdIt) + + let _data = mdIt.render(data) if (config.confluencer) { - const confluenceHtml = config.confluenceHtml || /

!confluence\b/m.test(_data) - _data = await confluencer.render(_data, { isHtml: !confluenceHtml, style: false }) + const confluenceHtml = + config.confluenceHtml || /

!confluence\b/m.test(_data) + _data = await confluencer.render(_data, { + isHtml: !confluenceHtml, + style: false + }) } // add template diff --git a/package.json b/package.json index 15128b8..0b10efd 100644 --- a/package.json +++ b/package.json @@ -36,10 +36,9 @@ "all": "npm-run-all clean lint build test", "ci": "npm run all", "build": "webpack --mode production", - "clean": "rimraf assets/fonts assets/index* assets/*.hot-update.js* .nyc_output coverage *.tgz", + "clean": "rimraf assets/* .nyc_output coverage *.tgz", "coverage": "c8 -r html -r text npm test", "dev": "webpack -w", - "__postinstall": "semver-dedupe katex@^0.6 markdown-it@^8 highlight.js@^9", "lint": "eslint --ext .js .", "man": "marked-man man/mdstart.md > man/mdstart.1 && man man/mdstart.1 > man/mdstart.txt", "prepublishOnly": "npm run all", @@ -52,59 +51,56 @@ "exit": true }, "dependencies": { - "@commenthol/markdown-it-katex": "^2.0.7", + "@commenthol/markdown-it-katex": "^2.0.8", "asyncc": "^2.0.6", "body-parser": "^1.20.2", "confluencer": "^1.5.1", - "cookie": "^0.5.0", + "cookie": "^0.6.0", "express": "^4.18.2", "highlight.js": "^11.9.0", - "katex": "^0.16.9", "lodash": "^4.17.21", - "markdown-it": "^13.0.2", - "markdown-it-abbr": "^1.0.4", + "markdown-it": "^14.0.0", + "markdown-it-abbr": "^2.0.0", "markdown-it-admon": "^1.0.0", "markdown-it-anchor": "^8.6.7", "markdown-it-attrs": "^4.1.6", - "markdown-it-deflist": "^2.1.0", - "markdown-it-emoji": "^2.0.2", - "markdown-it-footnote": "^3.0.3", + "markdown-it-deflist": "^3.0.0", + "markdown-it-emoji": "^3.0.0", + "markdown-it-footnote": "^4.0.0", "markdown-it-highlightjs": "^4.0.1", - "markdown-it-mark": "^3.0.1", + "markdown-it-mark": "^4.0.0", "markdown-it-multimd-table": "^4.2.3", - "markdown-it-sub": "^1.0.0", - "markdown-it-sup": "^1.0.0", + "markdown-it-sub": "^2.0.0", + "markdown-it-sup": "^2.0.0", "markdown-it-task-lists": "^2.1.1", - "markedpp": "^1.2.0", - "semver-dedupe": "^1.1.2", + "markedpp": "^1.3.0", "serve-index": "^1.9.1", "serve-static": "^1.15.0", - "ws": "^8.14.2" + "ws": "^8.16.0" }, "devDependencies": { - "@babel/core": "^7.23.2", + "@babel/core": "^7.23.6", "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-transform-react-jsx": "^7.22.15", - "@babel/preset-env": "^7.23.2", + "@babel/plugin-transform-react-jsx": "^7.23.4", + "@babel/preset-env": "^7.23.6", "@babel/register": "^7.22.15", "babel-eslint": "^10.1.0", "babel-loader": "^9.1.3", "css-loader": "^6.8.1", - "eslint": "^8.51.0", + "eslint": "^8.56.0", "eslint-config-standard": "^17.1.0", - "eslint-plugin-import": "^2.28.1", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-react": "^7.33.2", - "file-loader": "^6.2.0", + "katex": "^0.16.9", "mini-css-extract-plugin": "^2.7.6", "mocha": "^10.2.0", "normalize.css": "^8.0.1", - "npm-run-all": "^4.1.5", + "npm-run-all2": "^6.1.1", "rimraf": "^5.0.5", "style-loader": "^3.3.3", "supertest": "^6.3.3", - "url-loader": "^4.1.1", "webpack": "^5.89.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^4.15.1" diff --git a/webpack.config.js b/webpack.config.js index 1843f8f..24774ef 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,34 +30,26 @@ const conf = { ] } } - }, { + }, + { test: /\.css$/, use: [ { loader: MiniCssExtractPlugin.loader }, { loader: 'css-loader' } ] - }, { + }, + { test: /\.(png|jpg|gif)$/i, - use: [ - { - loader: 'url-loader', - options: { - limit: 8192, - name: 'imgs/[name][hash].[ext]' - } - } - ] + type: 'asset/resource', + generator: { + filename: 'imgs/[name][hash][ext]' + } }, { test: /\.(eot|svg|ttf|woff2?)$/i, - use: [ - { - loader: 'url-loader', - options: { - limit: 8192, - name: 'fonts/[name][hash].[ext]' - } - } - ] + type: 'asset/resource', + generator: { + filename: 'fonts/[name][hash][ext]' + } } ] },