Skip to content

Commit

Permalink
feat: update to markdown-it@14
Browse files Browse the repository at this point in the history
fix: webpack@5 asset processing
chore: bump all dependencies
  • Loading branch information
commenthol committed Dec 28, 2023
1 parent 9747c6b commit 6888939
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 58 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/bin/mdstart.js"
}
]
}
2 changes: 1 addition & 1 deletion client/src/index.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'), {
Expand Down
24 changes: 12 additions & 12 deletions lib/markd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || /<p>!confluence\b/m.test(_data)
_data = await confluencer.render(_data, { isHtml: !confluenceHtml, style: false })
const confluenceHtml =
config.confluenceHtml || /<p>!confluence\b/m.test(_data)
_data = await confluencer.render(_data, {
isHtml: !confluenceHtml,
style: false
})
}

// add template
Expand Down
44 changes: 20 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand 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"
Expand Down
32 changes: 12 additions & 20 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
}
}
]
},
Expand Down

0 comments on commit 6888939

Please sign in to comment.