chore: update devDependencies.

This commit is contained in:
jaywcjlove 2021-10-04 23:19:43 +08:00
parent 9f78f8a578
commit 25de570d79
5 changed files with 44 additions and 76 deletions

View File

@ -3,15 +3,7 @@ import path from 'path';
import stylus from 'stylus'; import stylus from 'stylus';
import * as ejs from 'ejs'; import * as ejs from 'ejs';
import UglifyJS from 'uglify-js'; import UglifyJS from 'uglify-js';
import { unified } from 'unified'; import { create } from 'markdown-to-html-cli';
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 _ from 'colors-cli/toxic.js'; import _ from 'colors-cli/toxic.js';
const deployDir = path.resolve(process.cwd(), '.deploy'); 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()); const mdhtml = await markdownToHTML(READMESTR.toString());
html = html.replace(/{{content}}/, mdhtml); html = html.replace(/{{content}}/, mdhtml);
await FS.outputFile(toPath, html); 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) => { // marked(READMESTR.toString(), (err, mdhtml) => {
// if (err) return reject(err); // if (err) return reject(err);
// html = html.replace(/{{content}}/, mdhtml); // html = html.replace(/{{content}}/, mdhtml);
@ -199,7 +191,7 @@ const cssPath = path.resolve(deployDir, 'css', 'index.css');
// }); // });
} else { } else {
await FS.outputFile(toPath, html); await FS.outputFile(toPath, html);
console.log(` ${'→'.green} ${toPath.replace(process.cwd(), '')}`); console.log(` ${'♻️ →'.green} ${path.relative(process.cwd(), toPath)}`);
resolve(html); resolve(html);
} }
} catch (err) { } catch (err) {
@ -209,17 +201,7 @@ const cssPath = path.resolve(deployDir, 'css', 'index.css');
} }
function markdownToHTML(str) { function markdownToHTML(str) {
return unified() return create({ markdown: str, document: undefined, 'github-corners': 'https://github.com/jaywcjlove/linux-command.git' });
.use(remarkParse)
.use(remark2rehype, { allowDangerousHtml: true })
.use(rehypeRaw)
.use(rehypeSlug)
.use(rehypeAutolinkHeadings)
.use(rehypePrism.default)
.use(rehypeAttrs, { properties: 'attr' })
.use(stringify)
.processSync(str)
.toString()
} }
/** /**

View File

@ -25,23 +25,15 @@
"url": "git+https://github.com/jaywcjlove/linux-command.git" "url": "git+https://github.com/jaywcjlove/linux-command.git"
}, },
"devDependencies": { "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", "archiver": "5.3.0",
"colors-cli": "1.0.27", "colors-cli": "1.0.28",
"ejs": "3.1.6", "ejs": "3.1.6",
"fs-extra": "10.0.0", "fs-extra": "10.0.0",
"markdown-to-html-cli": "2.0.0",
"sitemap-generator": "8.5.1", "sitemap-generator": "8.5.1",
"sqlite3": "5.0.2", "sqlite3": "5.0.2",
"stylus": "0.54.8", "stylus": "0.55.0",
"uglify-js": "3.14.1" "uglify-js": "3.14.2"
}, },
"engines": { "engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" "node": "^12.20.0 || ^14.13.1 || >=16.0.0"

View File

@ -1,4 +1,3 @@
<a href="https://github.com/jaywcjlove/linux-command" target="_blank" class="github-corner"> <svg viewBox="0 0 250 250"><!-- kenny wang <wowohoo@qq.com> https://github.com/jaywcjlove --> <title>logo</title> <desc>Linux Command Logo. https://github.com/jaywcjlove</desc><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg> </a>
<div class="header<%if(type=='list'){%> header_list<%}%>"> <div class="header<%if(type=='list'){%> header_list<%}%>">
<div class="logo"> <div class="logo">
<a href="/"> <a href="/">

View File

@ -298,17 +298,4 @@ a {
.search_list, .hotlist { .search_list, .hotlist {
padding 129px 27px padding 129px 27px
} }
div.markdown-body{
padding: 140px 10px 10px 13px;
}
div.markdown-body .edit_btn + *{
margin-top: 0 !important;
}
div.markdown-body .edit_btn {
top: 9px;
a {
background #f1f1f1
color #a3a3a3
}
}
} }

View File

@ -1,5 +1,39 @@
.markdown-body { mq-mobile = "screen and (max-width: 479px)"
.edit_btn {
position relative
right 38px
float right
top 110px
z-index 2
@media mq-mobile {
top 140px
right 15px
}
.split {
display inline-block
height 13px
vertical-align middle
width 1px
border-left 1px solid #dfdfdf
margin -1px 0 0 0
}
a {
text-decoration none
background #2196F3
color #fff
border-radius 3px
padding 2px 5px
&:hover{
color #333
background #e6e6e6
}
}
}
.wmde-markdown {
padding 70px 35px 30px 35px padding 70px 35px 30px 35px
word-wrap break-word word-wrap break-word
font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace; font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
@ -7,33 +41,7 @@
line-height 1.6 line-height 1.6
color #333 color #333
@media mq-mobile { @media mq-mobile {
padding-right 0 padding: 120px 15px 30px 15px;
}
.edit_btn {
position relative
right 0
float right
top 48px
z-index 2
.split {
display inline-block
height 13px
vertical-align middle
width 1px
border-left 1px solid #dfdfdf
margin -1px 0 0 0
}
a {
text-decoration none
background #2196F3
color #fff
border-radius 3px
padding 2px 5px
&:hover{
color #333
background #e6e6e6
}
}
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
a { a {