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
5 changes: 4 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ function localeTheme(prefix: string, labels: Labels): DefaultTheme.Config {
],
sidebar: sidebar(prefix, labels),
editLink: {
pattern: "https://github.com/stack-sh/web/edit/main/docs/:path",
pattern: ({ relativePath }) =>
/^(?:(?:ja|zh|ko)\/)?guide\/agent-workflow\.md$/.test(relativePath)
? "https://github.com/stack-sh/docs/edit/main/content/agent-workflow.md"
: `https://github.com/stack-sh/docs/edit/main/content/site/${relativePath}`,
text: labels.edit,
},
outline: { level: [2, 3], label: labels.outline },
Expand Down
13 changes: 13 additions & 0 deletions scripts/validate-docs-output.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ for (const location of locations) {

const route = new URL(location).pathname.replace(/^\/docs\//, "")
const markdownPath = route.endsWith("/") || route === "" ? `${route}index.md` : `${route}.md`
const htmlPath = markdownPath.replace(/\.md$/, ".html")
const html = await readFile(path.join(outputRoot, htmlPath), "utf8")
const editSource = /^(?:(?:ja|zh|ko)\/)?guide\/agent-workflow\.md$/.test(markdownPath)
? "content/agent-workflow.md"
: `content/site/${markdownPath}`
// Locale landing pages use VitePress's home layout, which has no edit footer.
const isLocaleHome = /^(?:(?:ja|zh|ko)\/)?index\.md$/.test(markdownPath)
if (!isLocaleHome && !html.includes(`https://github.com/stack-sh/docs/edit/main/${editSource}`)) {
throw new Error(`Edit link does not target the canonical Docs source: ${htmlPath}`)
}
if (html.includes("https://github.com/stack-sh/web/edit/main/docs/")) {
throw new Error(`Retired Web source edit link remains: ${htmlPath}`)
}
const markdown = await readFile(path.join(outputRoot, markdownPath), "utf8")

if (!markdown.trim()) throw new Error(`Markdown alternate is empty: ${markdownPath}`)
Expand Down