diff --git a/docs/docs/06-For CISOs/security-vulnerability.md b/docs/docs/06-For CISOs/security-vulnerability.md index e32b225..2a77343 100644 --- a/docs/docs/06-For CISOs/security-vulnerability.md +++ b/docs/docs/06-For CISOs/security-vulnerability.md @@ -2,5 +2,7 @@ slug: /security-vulnerability title: Security Vulnerability draft: true +pagination_next: null --- + # Security Vulnerability diff --git a/docs/pdfs/metal-stack-docs.pdf b/docs/pdfs/metal-stack-docs.pdf new file mode 100644 index 0000000..5145ad7 Binary files /dev/null and b/docs/pdfs/metal-stack-docs.pdf differ diff --git a/package.json b/package.json index 9b5396e..09d9849 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "fetch-readmes": "bun ./scripts/fetch-readmes.js", "optimize:svg": "svgo -f . --recursive --multipass", "prepare": "husky", - "create-release-notes": "bun ./scripts/create-release-notes.js" + "create-release-notes": "bun ./scripts/create-release-notes.js", + "docs:pdf": "bun ./scripts/docs-pdf.mjs" }, "dependencies": { "@carbon/icons-react": "^11.71.0", diff --git a/scripts/docs-pdf.mjs b/scripts/docs-pdf.mjs new file mode 100644 index 0000000..07e9b6d --- /dev/null +++ b/scripts/docs-pdf.mjs @@ -0,0 +1,91 @@ +import { spawnSync } from "node:child_process"; +import { resolve } from "node:path"; +import { readFileSync } from "node:fs"; + +import version from '../src/version.json' with { type: 'json' }; + +function env(name, fallback) { + return process.env[name] ?? fallback; +} + +const DOC_URL = env("DOC_URL", "http://localhost:3000/docs/next/home"); +const DOC_VERSION = env("DOC_VERSION", "3"); +const COVER_IMAGE = env("COVER_IMAGE", "https://metal-stack.io/img/metal-stack.png"); +const COVER_TITLE = env("COVER_TITLE", "metal-stack.io"); +const COVER_SUB = env("COVER_SUB", "Documentation Version " + version.version); + +if (process.env.CI && DOC_URL.includes("localhost")) { + console.error( + `Refusing to run in CI with DOC_URL=${DOC_URL}. Set DOC_URL to your deployed preview URL or start a server in CI.` + ); + process.exit(1); +} + +const logoPath = resolve(__dirname, "../static/img/metal-stack.png"); +const logoBase64 = readFileSync(logoPath).toString("base64"); +const logoDataUri = `data:image/png;base64,${logoBase64}`; + +const headerTemplate = ` + + +
+
+ + metal-stack.io | Documentation +
+
${version.version}
+
+`; + +const footerTemplate = ` + + + +`; + +const args = [ + "docs-to-pdf", + "docusaurus", + `--initialDocURLs=${DOC_URL}`, + `--version=${DOC_VERSION}`, + `--coverImage=${COVER_IMAGE}`, + `--coverTitle=${COVER_TITLE}`, + `--coverSub=${COVER_SUB}`, + `--excludeSelectors=".margin-vert--xl a,[class^='tocCollapsible']"`, + `--contentSelector="main"`, + `--outputPDFFilename=./docs/pdfs/metal-stack-docs.pdf`, + `--headerTemplate=${headerTemplate}`, + `--footerTemplate=${footerTemplate}`, +]; + +const res = spawnSync("npx", args, { stdio: "inherit", shell: process.platform === "win32" }); +process.exit(res.status ?? 1); diff --git a/src/css/custom.css b/src/css/custom.css index 5ee4be1..4e4bd8d 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -240,4 +240,44 @@ footer { left: 0; width: 100%; height: 100%; +} + +@media print { + @page { + size: A4; + background-color: var(--color-neutral-50); + margin: 12mm 10mm; + } + + :root { + --font-size-base: 0.9rem; + --ifm-font-size-base: 0.9rem; + --ifm-line-height-base: 1.4; + } + + body { + font-size: var(--font-size-base) !important; + color: #000 !important; + background: var(--color-neutral-50); + } + + .navbar, + footer, + .theme-doc-toc-desktop, + .theme-doc-footer, + .theme-doc-version-banner, + .theme-doc-breadcrumbs, + .theme-doc-version-badge, + .theme-edit-this-page { + display: none !important; + } + + .container { + max-width: 100% !important; + width: 100% !important; + padding-left: 0 !important; + padding-right: 0 !important; + margin-left: 0 !important; + margin-right: 0 !important; + } } \ No newline at end of file