mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-22 06:51:31 +08:00
feat: add sketch
cheatsheet.
This commit is contained in:
@ -118,17 +118,18 @@ export function create(str = '', options = {}) {
|
||||
let description = str.match(/\n==={1,}\n+([\s\S]*?)\n/g);
|
||||
title = title[0] || '';
|
||||
description = (description[0] || '').replace(/^\n[=\n]+/, '').replace(/\[([\s\S]*?)?\]\(([\s\S]*?)?\)/g, '$1').replace(/\n/, '');
|
||||
const subTitle = options.filename && !options.isHome ? `${options.filename} cheatsheet & `: ''
|
||||
const mdOptions = {
|
||||
hastNode: false,
|
||||
remarkPlugins: [],
|
||||
rehypePlugins: [
|
||||
rehypeFormat,
|
||||
[rehypeDocument, {
|
||||
title: `${title ? `${title} & ` : ''} Quick Reference`,
|
||||
title: `${title ? `${title} & ` : ''} ${subTitle} Quick Reference`,
|
||||
css: [ ...options.css ],
|
||||
meta: [
|
||||
{ description: `${description}为开发人员分享快速参考备忘单。` },
|
||||
{ keywords: 'Quick,Reference' }
|
||||
{ keywords: `Quick,Reference,cheatsheet,${!options.isHome && options.filename || ''}` }
|
||||
]
|
||||
}],
|
||||
],
|
||||
|
@ -24,6 +24,7 @@ async function createHTML(files = [], num = 0) {
|
||||
await fs.ensureDir(path.dirname(outputHTMLPath));
|
||||
|
||||
const html = create(mdstr.toString(), {
|
||||
filename: path.basename(outputHTMLPath, '.html'),
|
||||
isHome: /README.md$/.test(path.relative(process.cwd(), dataFile.path)),
|
||||
githubURL,
|
||||
homePath: path.relative(path.dirname(outputHTMLPath), path.resolve(OUTOUT, 'index.html')),
|
||||
|
Reference in New Issue
Block a user