Merge pull request #768 from ldapjs/dependabot/npm_and_yarn/marked-4.0.0

This commit is contained in:
Tony Brix 2021-11-13 01:11:04 -06:00 committed by GitHub
commit 11ccea9e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -36,7 +36,7 @@
"get-port": "^5.1.1", "get-port": "^5.1.1",
"highlight.js": "^11.0.1", "highlight.js": "^11.0.1",
"husky": "^4.2.5", "husky": "^4.2.5",
"marked": "^3.0.0", "marked": "^4.0.0",
"tap": "15.0.10" "tap": "15.0.10"
}, },
"scripts": { "scripts": {

View File

@ -1,13 +1,13 @@
const fs = require('fs/promises') const fs = require('fs/promises')
const path = require('path') const path = require('path')
const marked = require('marked') const { marked } = require('marked')
const fm = require('front-matter') const fm = require('front-matter')
const { highlight } = require('highlight.js') const { highlight } = require('highlight.js')
marked.use({ marked.use({
highlight: (code, lang) => { highlight: (code, lang) => {
if (lang) { if (lang) {
return highlight(lang, code).value return highlight(code, { language: lang }).value
} }
return code return code
@ -100,7 +100,13 @@ async function createDocs () {
const branding = path.join(docs, 'branding') const branding = path.join(docs, 'branding')
const src = path.join(branding, 'public') const src = path.join(branding, 'public')
await fs.rmdir(dist, { recursive: true }) try {
await fs.rm(dist, { recursive: true })
} catch (ex) {
if (ex.code !== 'ENOENT') {
throw ex
}
}
await copyRecursive(src, dist) await copyRecursive(src, dist)
const highlightjsStyles = path.resolve(__dirname, '..', 'node_modules', 'highlight.js', 'styles') const highlightjsStyles = path.resolve(__dirname, '..', 'node_modules', 'highlight.js', 'styles')