From 10f10f478550850e25e3fbd1e41de5fa5716301c Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 12 Jan 2026 16:00:19 +0800 Subject: [PATCH] # support --- web/eslint-rules/doc-redirects.js | 2 +- web/eslint.config.mjs | 2 +- web/scripts/gen-doc-paths.ts | 14 +++++++++++--- web/types/doc-paths.ts | 11 ++++++++--- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/web/eslint-rules/doc-redirects.js b/web/eslint-rules/doc-redirects.js index 8891bcdfb9..d33e2d3fde 100644 --- a/web/eslint-rules/doc-redirects.js +++ b/web/eslint-rules/doc-redirects.js @@ -2,7 +2,7 @@ // DON NOT EDIT IT MANUALLY // // Generated from: https://raw.githubusercontent.com/langgenius/dify-docs/refs/heads/main/docs.json -// Generated at: 2026-01-12T06:51:06.502Z +// Generated at: 2026-01-12T07:59:44.777Z /** @type {Map} */ export const docRedirects = new Map([ diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs index 654465f437..81f243d055 100644 --- a/web/eslint.config.mjs +++ b/web/eslint.config.mjs @@ -35,7 +35,7 @@ export default antfu( }, }, nextjs: true, - ignores: ['public'], + ignores: ['public', 'types/doc-paths.ts'], typescript: { overrides: { 'ts/consistent-type-definitions': ['error', 'type'], diff --git a/web/scripts/gen-doc-paths.ts b/web/scripts/gen-doc-paths.ts index a7b2fef081..5babc31335 100644 --- a/web/scripts/gen-doc-paths.ts +++ b/web/scripts/gen-doc-paths.ts @@ -165,14 +165,22 @@ function generateTypeDefinitions(groups: Record>): string { lines.push('') typeNames.push('ApiReferencePath') - // Generate combined type - lines.push('// Combined path without language prefix') - lines.push('export type DocPathWithoutLang =') + // Generate base combined type + lines.push('// Base path without language prefix') + lines.push('export type DocPathWithoutLangBase =') for (const typeName of typeNames) { lines.push(` | ${typeName}`) } lines.push('') + // Generate combined type with optional anchor support + lines.push('// Combined path without language prefix (supports optional #anchor)') + lines.push('export type DocPathWithoutLang =') + lines.push(' | DocPathWithoutLangBase') + // eslint-disable-next-line no-template-curly-in-string + lines.push(' | `${DocPathWithoutLangBase}#${string}`') + lines.push('') + // Generate full path type with language prefix lines.push('// Full documentation path with language prefix') // eslint-disable-next-line no-template-curly-in-string diff --git a/web/types/doc-paths.ts b/web/types/doc-paths.ts index 011e25e4ee..02d47f27a1 100644 --- a/web/types/doc-paths.ts +++ b/web/types/doc-paths.ts @@ -2,7 +2,7 @@ // DON NOT EDIT IT MANUALLY // // Generated from: https://raw.githubusercontent.com/langgenius/dify-docs/refs/heads/main/docs.json -// Generated at: 2026-01-12T06:51:06.500Z +// Generated at: 2026-01-12T07:59:44.775Z // Language prefixes export type DocLanguage = 'en' | 'zh' | 'ja' @@ -165,12 +165,17 @@ export type ApiReferencePath = | 'api-reference/openapi_knowledge.json' | 'api-reference/openapi_completion.json' -// Combined path without language prefix -export type DocPathWithoutLang = +// Base path without language prefix +export type DocPathWithoutLangBase = | UseDifyPath | SelfHostPath | DevelopPluginPath | ApiReferencePath +// Combined path without language prefix (supports optional #anchor) +export type DocPathWithoutLang = + | DocPathWithoutLangBase + | `${DocPathWithoutLangBase}#${string}` + // Full documentation path with language prefix export type DifyDocPath = `${DocLanguage}/${DocPathWithoutLang}`