feat: add find.md & sed.md cheatsheet.

This commit is contained in:
jaywcjlove
2022-09-30 00:26:09 +08:00
parent a612c2b971
commit 3dfb4f90a3
4 changed files with 740 additions and 2 deletions

View File

@ -82,8 +82,8 @@ export function getTocsTree(arr = [], result = []) {
}
export function create(str = '', options = {}) {
let title = str.match(/[^===]+(?=[===])/g);
let description = str.match(/\n==={1,}\n+([\s\S]*?)\n/g);
let title = str.match(/[^===]+(?=[===])/g) || [];
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 & `: ''