feat: add sketch cheatsheet.

This commit is contained in:
jaywcjlove
2022-09-28 02:12:32 +08:00
parent 43c0fb0ec6
commit 29b891613d
5 changed files with 145 additions and 3 deletions

View File

@ -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 || ''}` }
]
}],
],