Skip to content
Merged
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: 1 addition & 1 deletion examples/sandbox/spawn_subprocess.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
46 changes: 46 additions & 0 deletions frontmatter_test.ts
Original file line number Diff line number Diff line change
@@ -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.`,
);
});
}
});
2 changes: 1 addition & 1 deletion runtime/reference/cli/audit.md
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion runtime/reference/cli/bundle.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Bundler"
title: "deno bundle"
oldUrl: /runtime/manual/cli/bundler/
command: bundle
openGraphLayout: "/open_graph/cli-commands.jsx"
Expand Down
Loading