Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(docs): stabilize anchor navigation and link release topics (#4287)

lyingbug6c3730a6adfd
diff --git a/README.md b/README.md
index 258fd2406..48a8cbd2e 100644
--- a/README.md
+++ b/README.md
@@ -168,13 +168,13 @@ All options, hardware requirements and deployment topologies: [Installation guid
### v0.8.3 <sub>· 2026-10-14 · [release notes](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3)</sub>
-- **Image gallery**: browse document images and filter by source, caption, OCR and image attributes.
-- **Multimodal Embedding**: support for multimodal embedding models that encode text and images into a shared vector space, including Tencent WeMM-Embedding and Qwen3-VL-Embedding, with opt-in image-vector retrieval and compatible image-aware reranking.
-- **Wiki graph**: clearer group layouts and theme captions, with group focus, switching and return to the full graph.
-- **Source citations**: navigate from an answer to the cited passage in the original document.
-- **Chat and tools**: on-demand attachment reading without a sandbox, unread replies, @ mention search, Docker terminals, Lite host skills and MCP interoperability updates.
-- **Administration and integrations**: platform user management, invitation-only signup mode, administrator model catalog, WeMM embeddings, TEI/Pinecone/Cohere reranking, Seafile and Traditional Chinese.
-- **Reliability**: broad retrieval, parsing, datasource, Wiki, OAuth and CLI fixes. Review [upgrade requirements](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#upgrade-notes) for registration modes, empty tool lists, database migrations and reindexing.
+- **[Image gallery](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#images)**: browse document images and filter by source, caption, OCR and image attributes.
+- **[Multimodal Embedding](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#multimodal-embedding)**: support for multimodal embedding models that encode text and images into a shared vector space, including Tencent WeMM-Embedding and Qwen3-VL-Embedding, with opt-in image-vector retrieval and compatible image-aware reranking.
+- **[Wiki graph](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#wiki-graph)**: clearer group layouts and theme captions, with group focus, switching and return to the full graph.
+- **[Source citations](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#conversation)**: navigate from an answer to the cited passage in the original document.
+- **[Chat and tools](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#tools)**: on-demand attachment reading without a sandbox, unread replies, @ mention search, Docker terminals, Lite host skills and MCP interoperability updates.
+- **[Administration and integrations](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#administration)**: platform user management, invitation-only signup mode, administrator model catalog, WeMM embeddings, TEI/Pinecone/Cohere reranking, Seafile and Traditional Chinese.
+- **[Reliability](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#other-changes)**: broad retrieval, parsing, datasource, Wiki, OAuth and CLI fixes. Review [upgrade requirements](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#upgrade-notes) for registration modes, empty tool lists, database migrations and reindexing.
### v0.8.2 <sub>· 2026-09-24 · [release notes](https://weknora.weixin.qq.com/docs/07-releases/v0.8.2)</sub>
diff --git a/README_CN.md b/README_CN.md
index 5438f9233..b6b34fe6e 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -168,13 +168,13 @@ docker compose up -d # 用新镜像重建容器
### v0.8.3 <sub>· 2026-10-14 · [版本说明](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3)</sub>
-- **画廊**:集中浏览文档图片,按来源、描述、OCR 与图片属性筛选,查看原图和出处。
-- **多模态 Embedding**:支持将文字与图片编码到同一向量空间的多模态向量模型,例如腾讯 WeMM-Embedding、Qwen3-VL-Embedding 等;可按需开启图片向量检索,并搭配支持图片输入的重排模型。
-- **Wiki 图谱**:重新组织分组布局与主题说明,支持聚焦分组、切换分组和返回全图。
-- **原文引用**:从回答直接定位原始文档中的引用片段。
-- **对话与工具**:无需沙箱即可按需读取附件,未读回答标记、@ 全局搜索、Docker 终端、Lite 本机技能与 MCP 兼容性更新。
-- **管理与集成**:平台用户管理、仅限邀请注册、管理员模型目录、WeMM 向量、TEI/Pinecone/Cohere 重排、Seafile 数据源与繁体中文。
-- **稳定性**:集中修复检索、解析、数据源、Wiki、OAuth 和 CLI。注册模式、空工具列表、数据库迁移与向量重建要求见[升级须知](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#upgrade-notes)。
+- **[画廊](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#images)**:集中浏览文档图片,按来源、描述、OCR 与图片属性筛选,查看原图和出处。
+- **[多模态 Embedding](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#multimodal-embedding)**:支持将文字与图片编码到同一向量空间的多模态向量模型,例如腾讯 WeMM-Embedding、Qwen3-VL-Embedding 等;可按需开启图片向量检索,并搭配支持图片输入的重排模型。
+- **[Wiki 图谱](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#wiki-graph)**:重新组织分组布局与主题说明,支持聚焦分组、切换分组和返回全图。
+- **[原文引用](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#conversation)**:从回答直接定位原始文档中的引用片段。
+- **[对话与工具](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#tools)**:无需沙箱即可按需读取附件,未读回答标记、@ 全局搜索、Docker 终端、Lite 本机技能与 MCP 兼容性更新。
+- **[管理与集成](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#administration)**:平台用户管理、仅限邀请注册、管理员模型目录、WeMM 向量、TEI/Pinecone/Cohere 重排、Seafile 数据源与繁体中文。
+- **[稳定性](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#other-changes)**:集中修复检索、解析、数据源、Wiki、OAuth 和 CLI。注册模式、空工具列表、数据库迁移与向量重建要求见[升级须知](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#upgrade-notes)。
### v0.8.2 <sub>· 2026-09-24 · [版本说明](https://weknora.weixin.qq.com/docs/07-releases/v0.8.2)</sub>
diff --git a/README_JA.md b/README_JA.md
index a7dc5c508..8c2c97160 100644
--- a/README_JA.md
+++ b/README_JA.md
@@ -168,13 +168,13 @@ docker compose up -d # 新しいイメージでコンテナを再作成
### v0.8.3 <sub>· 2026-10-14 · [リリースノート](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3)</sub>
-- **画像ギャラリー**:文書内の画像を一覧表示し、出典・説明・OCR・画像属性で絞り込み。
-- **マルチモーダル Embedding**:テキストと画像を同じベクトル空間で扱うモデルに対応。Tencent WeMM-Embedding や Qwen3-VL-Embedding などを利用でき、画像ベクトル検索と対応モデルによる画像リランキングを任意で有効化。
-- **Wiki グラフ**:グループ配置とテーマ説明を改善。グループへのフォーカス、切り替え、全体表示への復帰に対応。
-- **原文引用**:回答から原文の引用箇所へ直接移動。
-- **会話とツール**:サンドボックス不要の添付ファイルのオンデマンド読み取り、未読返信、@ 検索、Docker ターミナル、Lite ローカルスキル、MCP 互換性の改善。
-- **管理と連携**:ユーザー管理、招待による登録、管理者モデルカタログ、WeMM、TEI/Pinecone/Cohere、Seafile、繁体字中国語。
-- **安定性**:検索、解析、同期、Wiki、OAuth、CLI を修正。登録モード、空のツール一覧、DB 移行と再インデックスについては[アップグレード案内](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#upgrade-notes)を確認してください。
+- **[画像ギャラリー](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#images)**:文書内の画像を一覧表示し、出典・説明・OCR・画像属性で絞り込み。
+- **[マルチモーダル Embedding](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#multimodal-embedding)**:テキストと画像を同じベクトル空間で扱うモデルに対応。Tencent WeMM-Embedding や Qwen3-VL-Embedding などを利用でき、画像ベクトル検索と対応モデルによる画像リランキングを任意で有効化。
+- **[Wiki グラフ](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#wiki-graph)**:グループ配置とテーマ説明を改善。グループへのフォーカス、切り替え、全体表示への復帰に対応。
+- **[原文引用](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#conversation)**:回答から原文の引用箇所へ直接移動。
+- **[会話とツール](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#tools)**:サンドボックス不要の添付ファイルのオンデマンド読み取り、未読返信、@ 検索、Docker ターミナル、Lite ローカルスキル、MCP 互換性の改善。
+- **[管理と連携](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#administration)**:ユーザー管理、招待による登録、管理者モデルカタログ、WeMM、TEI/Pinecone/Cohere、Seafile、繁体字中国語。
+- **[安定性](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#other-changes)**:検索、解析、同期、Wiki、OAuth、CLI を修正。登録モード、空のツール一覧、DB 移行と再インデックスについては[アップグレード案内](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#upgrade-notes)を確認してください。
### v0.8.2 <sub>· 2026-09-24 · [リリースノート](https://weknora.weixin.qq.com/docs/07-releases/v0.8.2)</sub>
diff --git a/README_KO.md b/README_KO.md
index 55c4f6fb1..63877a6bc 100644
--- a/README_KO.md
+++ b/README_KO.md
@@ -178,13 +178,13 @@ docker compose up -d # 새 이미지로 컨테이너 재생성
### v0.8.3 <sub>· 2026-10-14 · [릴리스 노트](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3)</sub>
-- **이미지 갤러리**: 문서 이미지를 모아 보고 출처, 설명, OCR 및 이미지 속성으로 필터링.
-- **멀티모달 Embedding**: 텍스트와 이미지를 같은 벡터 공간으로 인코딩하는 모델 지원. Tencent WeMM-Embedding, Qwen3-VL-Embedding 등을 사용할 수 있으며 이미지 벡터 검색과 호환 모델의 이미지 리랭킹을 선택적으로 활성화.
-- **Wiki 그래프**: 그룹 배치와 주제 설명을 개선하고 그룹 집중 보기, 그룹 전환 및 전체 그래프 복귀를 지원.
-- **원문 인용**: 답변에서 원문의 인용 부분으로 바로 이동.
-- **대화와 도구**: 샌드박스 없이 첨부 파일을 필요할 때 읽기, 읽지 않은 답변 표시, @ 검색, Docker 터미널, Lite 로컬 스킬과 MCP 호환성 개선.
-- **관리와 연동**: 플랫폼 사용자 관리, 초대 등록 모드, 관리자 모델 카탈로그, WeMM, TEI/Pinecone/Cohere, Seafile과 번체 중국어.
-- **안정성**: 검색, 파싱, 동기화, Wiki, OAuth와 CLI 수정. 등록 모드, 빈 도구 목록, DB 마이그레이션과 재색인은 [업그레이드 안내](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#upgrade-notes)를 확인하세요.
+- **[이미지 갤러리](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#images)**: 문서 이미지를 모아 보고 출처, 설명, OCR 및 이미지 속성으로 필터링.
+- **[멀티모달 Embedding](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#multimodal-embedding)**: 텍스트와 이미지를 같은 벡터 공간으로 인코딩하는 모델 지원. Tencent WeMM-Embedding, Qwen3-VL-Embedding 등을 사용할 수 있으며 이미지 벡터 검색과 호환 모델의 이미지 리랭킹을 선택적으로 활성화.
+- **[Wiki 그래프](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#wiki-graph)**: 그룹 배치와 주제 설명을 개선하고 그룹 집중 보기, 그룹 전환 및 전체 그래프 복귀를 지원.
+- **[원문 인용](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#conversation)**: 답변에서 원문의 인용 부분으로 바로 이동.
+- **[대화와 도구](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#tools)**: 샌드박스 없이 첨부 파일을 필요할 때 읽기, 읽지 않은 답변 표시, @ 검색, Docker 터미널, Lite 로컬 스킬과 MCP 호환성 개선.
+- **[관리와 연동](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#administration)**: 플랫폼 사용자 관리, 초대 등록 모드, 관리자 모델 카탈로그, WeMM, TEI/Pinecone/Cohere, Seafile과 번체 중국어.
+- **[안정성](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#other-changes)**: 검색, 파싱, 동기화, Wiki, OAuth와 CLI 수정. 등록 모드, 빈 도구 목록, DB 마이그레이션과 재색인은 [업그레이드 안내](https://weknora.weixin.qq.com/docs/07-releases/v0.8.3#upgrade-notes)를 확인하세요.
### v0.8.2 <sub>· 2026-09-24 · [릴리스 노트](https://weknora.weixin.qq.com/docs/07-releases/v0.8.2)</sub>
diff --git a/website-docs/.vitepress/config.mts b/website-docs/.vitepress/config.mts
index 414afd913..6d5bfffb3 100644
--- a/website-docs/.vitepress/config.mts
+++ b/website-docs/.vitepress/config.mts
@@ -5,6 +5,7 @@ import { defineConfig, type DefaultTheme } from 'vitepress'
import { withMermaid } from 'vitepress-plugin-mermaid'
import './theme-config.d.ts'
import { repoVersionLabel } from './version'
+import { readScreenshotSizes } from './screenshot-sizes.mjs'
const root = resolve(import.meta.dirname, '..')
const require = createRequire(import.meta.url)
@@ -133,6 +134,7 @@ export default withMermaid(
nav: [],
weknoraVersion: repoVersionLabel,
+ weknoraScreenshotSizes: readScreenshotSizes(resolve(root, 'public/screenshots')),
sidebar,
diff --git a/website-docs/.vitepress/screenshot-sizes.mjs b/website-docs/.vitepress/screenshot-sizes.mjs
new file mode 100644
index 000000000..0260c714d
--- /dev/null
+++ b/website-docs/.vitepress/screenshot-sizes.mjs
@@ -0,0 +1,27 @@
+import { closeSync, openSync, readSync, readdirSync } from 'node:fs';
+import { join } from 'node:path';
+
+// Read intrinsic sizes before rendering HTML so anchor positions do not depend
+// on when the screenshot requests finish. Product screenshots are PNG files.
+export function readScreenshotSizes(directory) {
+ const sizes = {};
+ for (const entry of readdirSync(directory, { withFileTypes: true })) {
+ if (!entry.isFile() || !entry.name.endsWith('.png')) continue;
+ const file = openSync(join(directory, entry.name), 'r');
+ const header = Buffer.alloc(24);
+ try {
+ if (readSync(file, header, 0, 24, 0) !== 24
+ || !header.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))
+ || header.toString('ascii', 12, 16) !== 'IHDR') {
+ throw new Error(`Invalid PNG screenshot: ${entry.name}`);
+ }
+ const width = header.readUInt32BE(16);
+ const height = header.readUInt32BE(20);
+ if (!width || !height) throw new Error(`Invalid screenshot dimensions: ${entry.name}`);
+ sizes[`/screenshots/${entry.name}`] = { width, height };
+ } finally {
+ closeSync(file);
+ }
+ }
+ return sizes;
+}
diff --git a/website-docs/.vitepress/theme-config.d.ts b/website-docs/.vitepress/theme-config.d.ts
index 241b1c8ac..60887e95c 100644
--- a/website-docs/.vitepress/theme-config.d.ts
+++ b/website-docs/.vitepress/theme-config.d.ts
@@ -4,5 +4,7 @@ declare module 'vitepress/dist/client/theme-default/config' {
export interface ThemeConfig {
/** 文档站点展示的 WeKnora 发布版本(来自仓库根 VERSION) */
weknoraVersion?: string
+ /** Intrinsic screenshot dimensions used to reserve layout before image loading. */
+ weknoraScreenshotSizes?: Record<string, { width: number; height: number }>
}
}
diff --git a/website-docs/.vitepress/theme/Screenshot.vue b/website-docs/.vitepress/theme/Screenshot.vue
index ef5028293..ce41f45bb 100644
--- a/website-docs/.vitepress/theme/Screenshot.vue
+++ b/website-docs/.vitepress/theme/Screenshot.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
-import { ref, computed } from 'vue'
-import { withBase } from 'vitepress'
+import { ref, computed, watch } from 'vue'
+import { useData, withBase } from 'vitepress'
const props = defineProps<{
/** 相对站点根的图片路径,约定放在 public/screenshots/ 下 */
@@ -11,26 +11,31 @@ const props = defineProps<{
hint?: string
}>()
-// 图片可能尚未补充。默认先渲染占位框,只有确实加载成功才换成图片,
-// 这样缺图时不会先闪一个碎图标再降级。
-const loaded = ref(false)
+const { theme } = useData()
+const size = computed(() => theme.value.weknoraScreenshotSizes?.[props.src])
+const failed = ref(false)
const resolved = computed(() => withBase(props.src))
+watch(resolved, () => { failed.value = false })
</script>
<template>
<figure class="wk-shot">
- <img
- v-show="loaded"
- class="wk-shot-img"
- :src="resolved"
- :alt="caption"
- @load="loaded = true"
- />
- <div v-if="!loaded" class="wk-shot-placeholder">
- <div class="wk-shot-placeholder-badge">截图待补充</div>
- <div class="wk-shot-placeholder-caption">{{ caption }}</div>
- <p v-if="hint" class="wk-shot-placeholder-hint">{{ hint }}</p>
- <code class="wk-shot-placeholder-path">website-docs/public{{ src }}</code>
+ <div class="wk-shot-media" :style="size ? { aspectRatio: `${size.width} / ${size.height}` } : undefined">
+ <img
+ v-if="size && !failed"
+ class="wk-shot-img"
+ :src="resolved"
+ :alt="caption"
+ :width="size.width"
+ :height="size.height"
+ @error="failed = true"
+ />
+ <div v-else class="wk-shot-placeholder" :class="{ 'wk-shot-placeholder-sized': size }">
+ <div class="wk-shot-placeholder-badge">{{ failed ? '图片加载失败' : '截图待补充' }}</div>
+ <div class="wk-shot-placeholder-caption">{{ caption }}</div>
+ <p v-if="hint" class="wk-shot-placeholder-hint">{{ hint }}</p>
+ <code class="wk-shot-placeholder-path">website-docs/public{{ src }}</code>
+ </div>
</div>
<figcaption class="wk-shot-caption">{{ caption }}</figcaption>
</figure>
@@ -41,9 +46,19 @@ const resolved = computed(() => withBase(props.src))
margin: 24px 0;
}
+.wk-shot-media { position: relative; }
+
+.wk-shot-placeholder-sized {
+ position: absolute;
+ inset: 0;
+ justify-content: center;
+ overflow: auto;
+}
+
.wk-shot-img {
display: block;
width: 100%;
+ height: auto;
border: 1px solid var(--vp-c-divider);
border-radius: 10px;
}
diff --git a/website-docs/.vitepress/theme/style.css b/website-docs/.vitepress/theme/style.css
index 5d6d357f1..607ff761a 100644
--- a/website-docs/.vitepress/theme/style.css
+++ b/website-docs/.vitepress/theme/style.css
@@ -53,10 +53,6 @@
--vp-code-block-bg: #0d1626;
}
-html {
- scroll-behavior: smooth;
-}
-
body {
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
diff --git a/website-docs/homepage/app/page.tsx b/website-docs/homepage/app/page.tsx
index 71de8edb6..01440d09d 100644
--- a/website-docs/homepage/app/page.tsx
+++ b/website-docs/homepage/app/page.tsx
@@ -34,7 +34,7 @@ const releaseSlides = [
{ name: "画廊", icon: "monitor", shots: [{ label: "浏览图片", icon: "monitor", image: "kb-image-gallery", alt: "知识库画廊:图片瀑布流与来源文档筛选" }, { label: "查看详情", icon: "file", image: "kb-image-gallery-detail", alt: "画廊图片详情:查看原图、图片描述、识别文字与来源文档" }], title: "文档图片,集中浏览", description: "集中浏览文档图片,按来源、描述和图片属性筛选,查看原图与出处。", link: guide("03-features/02-knowledge-base") + "#image-gallery" },
{ name: "多模态 Embedding", icon: "search", image: "kb-image-vector-settings", title: "文字与图片,共同检索", description: <>让图片、图表与文字共同参与知识检索,用自然语言查找相关内容。支持<a className={s.inlineRepoLink} href="https://github.com/Tencent/WeMM-Embedding" target="_blank" rel="noreferrer" aria-label="腾讯 WeMM-Embedding GitHub 仓库(新窗口)"><Icon name="github" />腾讯 WeMM-Embedding<Icon name="external" /></a>、Qwen3-VL-Embedding 等模型。</>, alt: "多模态 Embedding:知识库图像处理中的图片向量检索开关", link: guide("03-features/02-knowledge-base") + "#multimodal-embedding" },
{ name: "Wiki 图谱", icon: "channels", image: "wiki-graph-groups", title: "知识关系,按主题展开", description: "关联页面按主题分组,在全图与分组之间切换,沿关系找到值得继续阅读的内容。", alt: "Wiki 图谱全景:主题分组、页面关系与节点类型图例", link: guide("03-features/14-wiki") + "#wiki-graph" },
- { name: "原文引用定位", icon: "trace", image: "chat-source-location", title: "从回答,回到原文", description: "点击回答中的引用,在原始文档中定位对应段落,对照上下文核对答案。", alt: "回答引用与原始文档中的对应段落高亮", link: guide("03-features/18-chat-experience") },
+ { name: "原文引用定位", icon: "trace", image: "chat-source-location", title: "从回答,回到原文", description: "点击回答中的引用,在原始文档中定位对应段落,对照上下文核对答案。", alt: "回答引用与原始文档中的对应段落高亮", link: guide("03-features/18-chat-experience") + "#查看回答与来源" },
].map(withAvailability);
const browserSlides = [
{ name: "执行任务", icon: "browser", title: "在自己的浏览器里完成任务",
diff --git a/website-docs/scripts/check-site.mjs b/website-docs/scripts/check-site.mjs
index a0f9f8d86..0682eed85 100644
--- a/website-docs/scripts/check-site.mjs
+++ b/website-docs/scripts/check-site.mjs
@@ -21,10 +21,11 @@ const failures = [];
for (const entry of await readdir(root)) {
if (!['index.html', '404.html', 'docs'].includes(entry)) failures.push(`/${entry}: only index.html, 404.html and docs/ may sit at the site root`);
}
-// Screenshot.vue renders a labelled placeholder until the image is added, so a
-// missing docs screenshot is reported as pending instead of failing the build.
+// Missing screenshots may use labelled placeholders; existing images must
+// reserve their intrinsic dimensions before loading to keep anchors stable.
const pendingShots = new Set();
const checked = new Map();
+const targetIds = new Map();
const pages = await walk(root);
for (const file of pages) {
const html = await readFile(file, 'utf8');
@@ -42,6 +43,21 @@ for (const file of pages) {
if (/class="wk-shot-img"/.test(tag) && url.pathname.startsWith('/docs/screenshots/')) pendingShots.add(url.pathname);
else failures.push(`${route}: missing ${url.pathname}`);
}
+ if (tag.startsWith('<img') && /class="wk-shot-img"/.test(tag)) {
+ if (!/\bwidth="[1-9]\d*"/.test(tag) || !/\bheight="[1-9]\d*"/.test(tag) || /display:\s*none/.test(tag)) {
+ failures.push(`${route}: screenshot ${url.pathname} must reserve its intrinsic size before loading`);
+ }
+ }
+ if (tag.startsWith('<a') && url.hash && checked.get(url.pathname)) {
+ const target = (await resolveSiteFile(root, url.pathname))?.path;
+ if (target?.endsWith('.html')) {
+ if (!targetIds.has(target)) {
+ const content = await readFile(target, 'utf8');
+ targetIds.set(target, new Set([...content.matchAll(/\bid="([^"]+)"/g)].map(match => match[1].replaceAll('&amp;', '&'))));
+ }
+ if (!targetIds.get(target).has(decodeURIComponent(url.hash.slice(1)))) failures.push(`${route}: missing anchor ${url.pathname}${url.hash}`);
+ }
+ }
if (url.pathname === '/' && tag.startsWith('<a') && /target="_blank"/.test(tag)) failures.push(`${route}: homepage link opens a new tab`);
}
}
@@ -51,4 +67,4 @@ for (const file of pages) {
for (const path of ['/docs/', '/docs/03-features/22-skills-sandbox.html', '/docs/03-features/23-memory.html', '/docs/07-releases/v0.8.3.html', '/docs/07-releases/v0.8.2.html', '/docs/07-releases/v0.8.0.html']) assert.ok(await resolveSiteFile(root, path), path);
assert.equal(failures.length, 0, [...new Set(failures)].join('\n'));
if (pendingShots.size) console.warn(`Screenshots still pending (placeholder shown): ${[...pendingShots].sort().join(', ')}`);
-console.log(`Unified site check passed: ${pages.length} pages, ${checked.size} local routes/assets, same-tab homepage links and documentation logos.`);
+console.log(`Unified site check passed: ${pages.length} pages, ${checked.size} local routes/assets, fragment targets, screenshot dimensions, same-tab homepage links and documentation logos.`);
diff --git a/website-docs/scripts/screenshot-sizes.test.mjs b/website-docs/scripts/screenshot-sizes.test.mjs
new file mode 100644
index 000000000..4d60a365f
--- /dev/null
+++ b/website-docs/scripts/screenshot-sizes.test.mjs
@@ -0,0 +1,25 @@
+import assert from 'node:assert/strict';
+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { test } from 'node:test';
+import { readScreenshotSizes } from '../.vitepress/screenshot-sizes.mjs';
+
+test('reserves each screenshot intrinsic ratio and picks up replacement dimensions', () => {
+ const dir = mkdtempSync(join(tmpdir(), 'weknora-shot-sizes-'));
+ try {
+ // IHDR bytes from a PNG header; the extractor deliberately does not decode pixels.
+ const header = Buffer.from('89504e470d0a1a0a0000000d4948445200000f0000000840', 'hex');
+ writeFileSync(join(dir, 'wide.png'), header);
+ writeFileSync(join(dir, 'README.md'), 'Not an image');
+ assert.deepEqual(readScreenshotSizes(dir), { '/screenshots/wide.png': { width: 3840, height: 2112 } });
+ header.writeUInt32BE(900, 16);
+ header.writeUInt32BE(1600, 20);
+ writeFileSync(join(dir, 'wide.png'), header);
+ assert.deepEqual(readScreenshotSizes(dir), { '/screenshots/wide.png': { width: 900, height: 1600 } });
+ writeFileSync(join(dir, 'broken.png'), 'truncated');
+ assert.throws(() => readScreenshotSizes(dir), /Invalid PNG screenshot/);
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+});