feat: add dockerfile.md cheatsheet.

This commit is contained in:
jaywcjlove
2022-09-30 17:33:13 +08:00
parent 410c8f09da
commit 7487fbf680
11 changed files with 209 additions and 25 deletions

View File

@ -1,20 +1,9 @@
import fs from 'fs-extra';
import rehypeParse from 'rehype-parse'
import {unified} from 'unified'
import path from 'path';
import { VFile } from 'vfile';
import { getSVGNode } from './getSVGNode.mjs';
const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets')
function getSVGNode(iconPath) {
const svgStr = fs.readFileSync(iconPath);
const processor = unified().use(rehypeParse,{ fragment: true, space: "svg" })
const file = new VFile();
file.value = svgStr.toString();
const hastNode = processor.runSync(processor.parse(file), file);
return hastNode.children || []
}
export function homeCardIcons(node, parent, isHome) {
if (isHome && node && node.type === 'element' && node.properties?.class?.includes('home-card')) {
node.children = node.children.map((child) => {