Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/docs/06-For CISOs/security-vulnerability.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
slug: /security-vulnerability
title: Security Vulnerability
draft: true
pagination_next: null
---

# Security Vulnerability
Binary file added docs/pdfs/metal-stack-docs.pdf
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
91 changes: 91 additions & 0 deletions scripts/docs-pdf.mjs
Original file line number Diff line number Diff line change
@@ -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 = `
<style>
.header {
width: 100%;
font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
font-size: 9px;
color: #111;
padding: 0 10mm;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}
.left { display: flex; align-items: center; gap: 8px; }
.logo { height: 14px; width: auto; display: block; }
.docs { font-weight: 600; font-size: 10px; }
.version { color: #525252; white-space: nowrap; }
</style>

<div class="header">
<div class="left">
<img class="logo" src="${logoDataUri}" />
<span class="docs">metal-stack.io | Documentation</span>
</div>
<div class="version">${version.version}</div>
</div>
`;

const footerTemplate = `
<style>
.footer {
width: 100%;
font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
font-size: 9px;
color: #525252;
padding: 0 10mm;
box-sizing: border-box;
display: flex;
justify-content: flex-end;
}
</style>

<div class="footer">
<span class="pageNumber"></span> / <span class="totalPages"></span>
</div>
`;

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);
40 changes: 40 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}