diff --git a/build/build.mjs b/build/build.mjs index b2649acce9..51f3738f13 100644 --- a/build/build.mjs +++ b/build/build.mjs @@ -3,15 +3,7 @@ import path from 'path'; import stylus from 'stylus'; import * as ejs from 'ejs'; import UglifyJS from 'uglify-js'; -import { unified } from 'unified'; -import rehypeAttrs from 'rehype-attr'; -import * as rehypePrism from '@mapbox/rehype-prism'; -import rehypeRaw from 'rehype-raw'; -import rehypeSlug from 'rehype-slug'; -import rehypeAutolinkHeadings from 'rehype-autolink-headings'; -import stringify from 'rehype-stringify'; -import remarkParse from 'remark-parse'; -import remark2rehype from 'remark-rehype'; +import { create } from 'markdown-to-html-cli'; import _ from 'colors-cli/toxic.js'; const deployDir = path.resolve(process.cwd(), '.deploy'); @@ -189,7 +181,7 @@ const cssPath = path.resolve(deployDir, 'css', 'index.css'); const mdhtml = await markdownToHTML(READMESTR.toString()); html = html.replace(/{{content}}/, mdhtml); await FS.outputFile(toPath, html); - console.log(` ${'♻️ →'.green} ${toPath.replace(process.cwd(), '')}`); + console.log(` ${'♻️ →'.green} ${path.relative(process.cwd(), toPath)}`); // marked(READMESTR.toString(), (err, mdhtml) => { // if (err) return reject(err); // html = html.replace(/{{content}}/, mdhtml); @@ -199,7 +191,7 @@ const cssPath = path.resolve(deployDir, 'css', 'index.css'); // }); } else { await FS.outputFile(toPath, html); - console.log(` ${'→'.green} ${toPath.replace(process.cwd(), '')}`); + console.log(` ${'♻️ →'.green} ${path.relative(process.cwd(), toPath)}`); resolve(html); } } catch (err) { @@ -209,17 +201,7 @@ const cssPath = path.resolve(deployDir, 'css', 'index.css'); } function markdownToHTML(str) { - return unified() - .use(remarkParse) - .use(remark2rehype, { allowDangerousHtml: true }) - .use(rehypeRaw) - .use(rehypeSlug) - .use(rehypeAutolinkHeadings) - .use(rehypePrism.default) - .use(rehypeAttrs, { properties: 'attr' }) - .use(stringify) - .processSync(str) - .toString() + return create({ markdown: str, document: undefined, 'github-corners': 'https://github.com/jaywcjlove/linux-command.git' }); } /** diff --git a/package.json b/package.json index 3a66f7d8bd..60c2907c40 100644 --- a/package.json +++ b/package.json @@ -25,23 +25,15 @@ "url": "git+https://github.com/jaywcjlove/linux-command.git" }, "devDependencies": { - "@mapbox/rehype-prism": "0.7.0", - "unified": "10.1.0", - "rehype-stringify": "9.0.2", - "rehype-raw": "6.1.0", - "rehype-slug": "5.0.0", - "rehype-autolink-headings": "6.1.0", - "remark-parse": "10.0.0", - "remark-rehype": "9.0.0", - "rehype-attr": "1.4.2", "archiver": "5.3.0", - "colors-cli": "1.0.27", + "colors-cli": "1.0.28", "ejs": "3.1.6", "fs-extra": "10.0.0", + "markdown-to-html-cli": "2.0.0", "sitemap-generator": "8.5.1", "sqlite3": "5.0.2", - "stylus": "0.54.8", - "uglify-js": "3.14.1" + "stylus": "0.55.0", + "uglify-js": "3.14.2" }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" diff --git a/template/search.ejs b/template/search.ejs index db343add9f..a3413b0365 100644 --- a/template/search.ejs +++ b/template/search.ejs @@ -1,4 +1,3 @@ -