diff --git a/examples/sandbox/spawn_subprocess.md b/examples/sandbox/spawn_subprocess.md index 8f109048a..20d2eeac9 100644 --- a/examples/sandbox/spawn_subprocess.md +++ b/examples/sandbox/spawn_subprocess.md @@ -1,5 +1,5 @@ --- -title: "Spawn a subprocess, and get buffered output" +title: "Spawn a subprocess and get buffered output" description: "Learn how to spawn a subprocess, and get buffered output in a sandbox." url: /examples/sandbox_spawn_subprocess/ layout: sandbox-example.tsx diff --git a/frontmatter_test.ts b/frontmatter_test.ts new file mode 100644 index 000000000..e8c511981 --- /dev/null +++ b/frontmatter_test.ts @@ -0,0 +1,46 @@ +import { walk } from "@std/fs"; +import { extract } from "@std/front-matter/yaml"; +import { assert, assertEquals } from "@std/assert"; + +const DIRS_TO_CHECK = ["./runtime", "./deploy", "./examples"]; + +Deno.test("Frontmatter titles must not contain backticks", async (t) => { + for (const dir of DIRS_TO_CHECK) { + for await (const entry of walk(dir, { exts: [".md", ".mdx"] })) { + const content = await Deno.readTextFile(entry.path); + if (!content.startsWith("---")) continue; + + const { attrs } = extract<{ title?: string }>(content); + if (typeof attrs.title !== "string") continue; + + await t.step(entry.path, () => { + assert( + !attrs.title!.includes("`"), + `Title contains backticks: "${attrs.title}". Use plain text instead.`, + ); + }); + } + } +}); + +Deno.test("CLI command page titles must be just the command name", async (t) => { + for await ( + const entry of walk("./runtime/reference/cli", { exts: [".md"] }) + ) { + const content = await Deno.readTextFile(entry.path); + if (!content.startsWith("---")) continue; + + const { attrs } = extract<{ title?: string; command?: string }>(content); + if (typeof attrs.command !== "string") continue; + + const expected = `deno ${attrs.command}`; + + await t.step(entry.path, () => { + assertEquals( + attrs.title, + expected, + `Title should be "${expected}", got "${attrs.title}". Put descriptions in the "description" field instead.`, + ); + }); + } +}); diff --git a/runtime/reference/cli/audit.md b/runtime/reference/cli/audit.md index 60368c254..9cd648ec3 100644 --- a/runtime/reference/cli/audit.md +++ b/runtime/reference/cli/audit.md @@ -1,5 +1,5 @@ --- -title: "deno audit, audit dependencies for vulnerabilities" +title: "deno audit" command: audit openGraphLayout: "/open_graph/cli-commands.jsx" openGraphTitle: "deno audit" diff --git a/runtime/reference/cli/bundle.md b/runtime/reference/cli/bundle.md index 17f6e2816..292a8c9cb 100644 --- a/runtime/reference/cli/bundle.md +++ b/runtime/reference/cli/bundle.md @@ -1,5 +1,5 @@ --- -title: "Bundler" +title: "deno bundle" oldUrl: /runtime/manual/cli/bundler/ command: bundle openGraphLayout: "/open_graph/cli-commands.jsx"