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

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 50 50" height="1em" width="1em">
<path style="text-indent:0;text-align:start;line-height:normal;text-transform:none;block-progression:tb;-inkscape-font-specification:Sans" d="M20 9v5H10v5H5v5H1.125a1 1 0 0 0-.969.813S0 25.666 0 26.75c0 .687.07 1.433.188 2.188C.13 28.95.051 28.986 0 29h.188a15.52 15.52 0 0 0 2.062 5.563c.005.007-.005.023 0 .03a1 1 0 0 0 .031.063 1 1 0 0 0 .375.594 1 1 0 0 0 .063.031c.307.445.633.89 1 1.313C6.396 39.679 10.737 42 17 42c10.221 0 18.869-4.354 23.75-13h9.094c-1.086-.275-3.42-.64-3.032-2.063-1.292 1.496-3.755 1.684-5.656 1.344.362-.688.717-1.385 1.032-2.125 2.891-.073 4.964-1.004 6.124-2.125 1.268-1.225 1.657-2.593 1.657-2.593a1 1 0 0 0-.344-1.032s-2.527-1.842-6.313-1.218c-1.08-3.537-3.874-5.25-3.874-5.25a1 1 0 0 0-.688-.126 1 1 0 0 0-.438.22s-.668.57-1.218 1.593c-.55 1.024-1.057 2.582-.875 4.594.085.941.382 1.837.812 2.687-.242.148-.383.273-.781.438-.828.342-2.034.656-3.75.656H32v-5h-5V9h-7zm2 2h3v3h-3v-3zm-10 5h3v3h-3v-3zm5 0h3v3h-3v-3zm5 0h3v3h-3v-3zm17.094.219c.742.549 2.085 1.701 2.562 4.218a1 1 0 0 0 1.25.782c2.55-.7 3.93-.125 4.688.312-.145.315-.12.514-.688 1.063-.91.88-2.452 1.766-5.343 1.656a1 1 0 0 0-.97.625 27.36 27.36 0 0 1-1.343 2.813 2.11 2.11 0 0 1-.375-.282c-1.338 1.94-9.113 1.2-9.656-.312-1.677 1.968-6.885 1.968-8.563 0-.543 1.512-8.35 2.252-9.687.312-1.201 1.126-5.932 1.816-7.906-.468.187.688-.297 1.133-.938 1.437A11.462 11.462 0 0 1 2 26.75c0-.431.033-.47.063-.75H32.5c1.969 0 3.446-.377 4.5-.813 1.054-.435 1.803-.969 1.906-1.03a1 1 0 0 0 .25-1.47c-.554-.724-.844-1.627-.937-2.656-.146-1.612.234-2.74.625-3.468.133-.248.139-.195.25-.344zM7 21h3v3H7v-3zm5 0h3v3h-3v-3zm5 0h3v3h-3v-3zm5 0h3v3h-3v-3zm5 0h3v3h-3v-3zM2.25 29H38.5C33.912 36.414 26.29 40 17 40c-5.47 0-9.016-1.854-11.344-4.313 4.438.211 7.875-.968 7.875-.968a1.008 1.008 0 0 0-.25-2 1.005 1.005 0 0 0-.156.031 1 1 0 0 0-.25.063S8.785 34.208 4 33.53A13.95 13.95 0 0 1 2.25 29zM16 31a1 1 0 1 0 1 1 .949.949 0 0 0-.063-.375.443.443 0 0 1-.375.219c-.225 0-.406-.213-.406-.438 0-.15.097-.273.219-.343A1.055 1.055 0 0 0 16 31z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,3 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-emoji-kiss-fill" viewBox="0 0 16 16" height="1em" width="1em">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16" height="1em" width="1em">
<path fill-rule="evenodd" d="M16 8a8 8 0 1 0-2.697 5.99c-.972-.665-1.632-1.356-1.99-2.062-.388-.766-.419-1.561-.075-2.23.496-.97 1.73-1.466 2.762-1.05.65-.262 1.38-.162 1.957.19.028-.275.043-.555.043-.838ZM7 6.5C7 7.328 6.552 8 6 8s-1-.672-1-1.5S5.448 5 6 5s1 .672 1 1.5Zm1.512 3.647c-.347.08-.737.198-1.107.319a.5.5 0 1 1-.31-.95c.38-.125.802-.254 1.192-.343.37-.086.78-.153 1.103-.108.16.022.394.085.561.286.188.226.187.497.131.705a1.894 1.894 0 0 1-.31.593c-.077.107-.168.22-.275.343.107.124.199.24.276.347.142.197.256.397.31.595.055.208.056.479-.132.706-.168.2-.404.262-.563.284-.323.043-.733-.027-1.102-.113a14.87 14.87 0 0 1-1.191-.345.5.5 0 1 1 .31-.95c.371.12.761.24 1.109.321.176.041.325.069.446.084a5.609 5.609 0 0 0-.502-.584.5.5 0 0 1 .002-.695 5.52 5.52 0 0 0 .5-.577 4.465 4.465 0 0 0-.448.082Zm.766-.086-.006-.002c.004 0 .006.002.006.002Zm.002 1.867h-.001l-.005.001a.038.038 0 0 1 .006-.002Zm.157-4.685a.5.5 0 0 1-.874-.486A1.934 1.934 0 0 1 10.25 5.75c.73 0 1.356.412 1.687 1.007a.5.5 0 1 1-.874.486.934.934 0 0 0-.813-.493.934.934 0 0 0-.813.493ZM14 9.828c1.11-1.14 3.884.856 0 3.422-3.884-2.566-1.11-4.562 0-3.421Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

3
scripts/assets/sed.svg Normal file
View File

@ -0,0 +1,3 @@
<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
<path d="M5 3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h4.22l.212-.845c.013-.052.027-.104.043-.155H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v4.232c.32-.137.659-.213 1-.229V5a2 2 0 0 0-2-2H5Zm4.5 11h1.443l1-1H9.5a.5.5 0 0 0 0 1Zm-2-6.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM6.75 11a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm0 3a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM9.5 7a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4Zm0 3a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4Zm1.48 5.377 4.83-4.83a1.87 1.87 0 1 1 2.644 2.646l-4.83 4.829a2.197 2.197 0 0 1-1.02.578l-1.498.374a.89.89 0 0 1-1.079-1.078l.375-1.498a2.18 2.18 0 0 1 .578-1.02Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 733 B

View File

@ -1,6 +1,10 @@
import { logo, github, editor } from './logo.mjs';
import path from 'path';
import { github, editor } from './logo.mjs';
import { getSVGNode } from '../utils/getSVGNode.mjs';
const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets/quickreference.svg')
export function header({ homePath, githubURL = '' }) {
const svgNode = getSVGNode(ICONS_PATH)
const data = [
{
href: githubURL,
@ -35,7 +39,19 @@ export function header({ homePath, githubURL = '' }) {
href: homePath,
class: ['logo'],
},
children: logo,
children: [
...svgNode,
{
type: 'element',
tagName: 'span',
properties: {
class: ['title'],
},
children: [
{ type: 'text', value: 'Quick Reference' }
]
}
],
},
{
type: 'element',

View File

@ -43,7 +43,7 @@ table {
border-collapse: collapse
}
table td:not(:last-child)>code, ul li > code, kbd {
table td:not(:last-child)>code, table td:not(:last-child)>del>code, ul li > code, kbd {
background-color: rgb(51 65 85/0.5);
color: rgb(203 213 225/1);
box-shadow: 0 0 #0000, 0 0 #0000, 0 0 #0000;
@ -84,6 +84,11 @@ table td:first-child>code {
--text-opacity: 1;
color: rgb(5 150 105/var(--text-opacity));
}
table td:first-child>del>code {
text-decoration: inherit;
--text-opacity: 1;
color: rgb(244 67 54/var(--text-opacity));
}
table.show-header thead {
display: table-header-group;
@ -188,7 +193,7 @@ body.home .h1wrap p {
--bg-opacity: 1;
}
.home-card a svg {
min-width: 1.5rem;
min-width: 1.6rem;
height: 1.8rem;
}
@ -703,7 +708,6 @@ a.text-grey {
/* 代码高亮 End */
.footer-wrap {
margin-top: 3.5rem;
color: rgb(100 116 139/1);

View File

@ -0,0 +1,13 @@
import fs from 'fs-extra';
import rehypeParse from 'rehype-parse';
import {unified} from 'unified';
import { VFile } from 'vfile';
export 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 || []
}

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) => {