From 7d4b7b992ab775ebe7d3fea2603ccf97c92b79bc Mon Sep 17 00:00:00 2001 From: Shine Date: Thu, 8 Oct 2026 16:25:52 +0800 Subject: [PATCH 1/5] docs: correct nested relative links and remove nonexistent API reference --- docs/CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index e80ad73..4a877c6 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -251,7 +251,7 @@ feat(sensor): 添加MPU6050陀螺仪支持 ### 技术文档 - [开发文档](DEVELOPMENT.md) - [硬件文档](HARDWARE.md) -- [API参考](docs/API.md) +- [开发说明](DEVELOPMENT.md) ### 工具和环境 - [Keil uVision5](https://www.keil.com/) @@ -272,7 +272,7 @@ feat(sensor): 添加MPU6050陀螺仪支持 ## 许可证 -通过向此项目贡献代码,您同意您的贡献将在 [MIT License](LICENSE) 下进行许可。 +通过向此项目贡献代码,您同意您的贡献将在 [MIT License](../LICENSE) 下进行许可。 ## 联系方式 @@ -283,7 +283,7 @@ feat(sensor): 添加MPU6050陀螺仪支持 ## 相关文档 -- [README.md](README.md) - 项目概述 +- [README.md](../README.md) - 项目概述 - [DEVELOPMENT.md](DEVELOPMENT.md) - 开发文档 - [HARDWARE.md](HARDWARE.md) - 硬件说明 From 735a0d1207f0498da2b493e6ed633068cf9c0bb6 Mon Sep 17 00:00:00 2001 From: Shine Date: Thu, 8 Oct 2026 16:25:57 +0800 Subject: [PATCH 2/5] docs: correct nested relative links and remove nonexistent API reference --- docs/DEVELOPMENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index fd24898..ddda0b1 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -371,7 +371,7 @@ printf("Temperature: %.1f°C\r\n", temperature); ## 相关文档 -- [README.md](README.md) - 项目概述 +- [README.md](../README.md) - 项目概述 - [HARDWARE.md](HARDWARE.md) - 硬件详细说明 - [CONTRIBUTING.md](CONTRIBUTING.md) - 贡献指南 From 63029c80588a51f5cfeb6a024225fa5660ad207a Mon Sep 17 00:00:00 2001 From: Shine Date: Thu, 8 Oct 2026 16:26:01 +0800 Subject: [PATCH 3/5] docs: correct nested relative links and remove nonexistent API reference --- docs/HARDWARE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/HARDWARE.md b/docs/HARDWARE.md index cfa9fef..e2bf26b 100644 --- a/docs/HARDWARE.md +++ b/docs/HARDWARE.md @@ -265,7 +265,7 @@ PC13 -> Buzzer ## 相关文档 -- [README.md](README.md) - 项目概述 +- [README.md](../README.md) - 项目概述 - [DEVELOPMENT.md](DEVELOPMENT.md) - 开发文档 - [CONTRIBUTING.md](CONTRIBUTING.md) - 贡献指南 From 492c910551b91cc72798e9ba8dfcb7026c24d67b Mon Sep 17 00:00:00 2001 From: Shine Date: Thu, 8 Oct 2026 16:26:18 +0800 Subject: [PATCH 4/5] test(docs): validate local README and documentation links --- scripts/check_docs_links.py | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 scripts/check_docs_links.py diff --git a/scripts/check_docs_links.py b/scripts/check_docs_links.py new file mode 100644 index 0000000..dfa3414 --- /dev/null +++ b/scripts/check_docs_links.py @@ -0,0 +1,49 @@ +"""Validate repository-local links in Markdown documentation. + +External destinations and fragment-only links are intentionally excluded; +this checker verifies local filesystem destinations, not external URLs. +""" +from pathlib import Path +import re +from urllib.parse import unquote, urlsplit + +ROOT = Path(__file__).resolve().parents[1] +LINK = re.compile(r"!?(?:\[[^\]\n]*\])\(([^)\n]+)\)") + + +def check_links(): + problems = [] + inspected = 0 + for md in sorted(ROOT.rglob("*.md")): + for match in LINK.finditer(md.read_text(encoding="utf-8")): + target = match.group(1).strip() + if target.startswith("<") and ">" in target: + target = target[1:target.index(">")] + else: + target = target.split(maxsplit=1)[0] + if not target or target.startswith("#"): + continue + parsed = urlsplit(target) + if parsed.scheme or parsed.netloc: + continue + clean = unquote(parsed.path) + if not clean: + continue + inspected += 1 + destination = (ROOT / clean.lstrip("/")) if clean.startswith("/") else (md.parent / clean) + destination = destination.resolve() + try: + destination.relative_to(ROOT) + except ValueError: + problems.append("{}: local link escapes repository: {}".format(md.relative_to(ROOT), target)) + continue + if not destination.exists(): + problems.append("{}: missing local target: {}".format(md.relative_to(ROOT), target)) + print("Checked {} local Markdown links".format(inspected)) + if problems: + raise SystemExit("\n".join(problems)) + print("All checked local links resolve.") + + +if __name__ == "__main__": + check_links() From 835628a77871acb4f79decc0f0e974db3d0fa4df Mon Sep 17 00:00:00 2001 From: Shine Date: Thu, 8 Oct 2026 16:26:28 +0800 Subject: [PATCH 5/5] ci: check documentation links with Keil project integrity checks --- .github/workflows/keil-path-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/keil-path-check.yml b/.github/workflows/keil-path-check.yml index 84a3a5f..21e46ec 100644 --- a/.github/workflows/keil-path-check.yml +++ b/.github/workflows/keil-path-check.yml @@ -16,3 +16,4 @@ jobs: python-version: '3.11' - run: python scripts/check_keil_paths.py - run: python scripts/check_hex_snapshot.py + - run: python scripts/check_docs_links.py