Add Markdown editor, server statistics and content navigation

This commit is contained in:
SantaSpeen committed 2026-12-02 15:32:14 +03:00
1 parent 03c590e172
commit 1819f35f91
52 files changed
+7190 -28

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
import { cp, mkdir, readFile, writeFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
const root = new URL("../", import.meta.url),
output = new URL("vendor/text/", root);
await mkdir(output, { recursive: true });
const files = {
"marked/lib/marked.esm.js": "marked.js",
"marked/LICENSE": "marked.LICENSE",
"dompurify/dist/purify.es.mjs": "purify.js",
"dompurify/LICENSE": "dompurify.LICENSE",
"dompurify/LICENSE-MPL": "dompurify.MPL.LICENSE",
"@highlightjs/cdn-assets/es/core.min.js": "highlight/core.js",
"@highlightjs/cdn-assets/LICENSE": "highlight.LICENSE",
};
const languages = [
"xml",
"javascript",
"typescript",
"json",
"yaml",
"bash",
"python",
"css",
"ini",
"nginx",
"sql",
"markdown",
];
for (const language of languages)
files[`@highlightjs/cdn-assets/es/languages/${language}.min.js`] =
`highlight/languages/${language}.js`;
for (const [source, target] of Object.entries(files)) {
const to = new URL(target, output);
await mkdir(fileURLToPath(new URL("./", to)), { recursive: true });
await cp(new URL(`node_modules/${source}`, root), to);
if (target.endsWith(".js"))
await writeFile(
to,
(await readFile(to, "utf8")).replace(/^\/\/# sourceMappingURL=.*$/gm, ""),
);
}
const versions = {};
for (const name of ["marked", "dompurify", "@highlightjs/cdn-assets"])
versions[name] = JSON.parse(
await readFile(new URL(`node_modules/${name}/package.json`, root), "utf8"),
).version;
await writeFile(
new URL("manifest.json", output),
JSON.stringify(
{
versions,
languages,
distribution: "Local browser ES modules; no CDN requests",
},
null,
2,
) + "\n",
);
console.log("Vendored Markdown, HTML sanitizer and syntax languages.");