From: Faidon Liambotis <paravoid@debian.org>
Date: Mon, 16 Feb 2026 00:04:16 +0200
Subject: mkdocs: fix generate_api.py's edit_path

Fix the edit_path to be relative, rather than hardcode the build
directory, and to point to the proper URL in the GitHub repository.
---
 docs/scripts/generate_api.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/docs/scripts/generate_api.py b/docs/scripts/generate_api.py
index 4d59a62..dc792ca 100644
--- a/docs/scripts/generate_api.py
+++ b/docs/scripts/generate_api.py
@@ -23,7 +23,10 @@ for path in sorted(src.rglob("*.py")):
         identifier = ".".join(parts)
         print("::: xsdata." + identifier, file=fd)
 
-    mkdocs_gen_files.set_edit_path(full_doc_path, path)
+    # point edit path to the .py file location. Given edit_uri is set to be
+    # docs/, we need to go one-level up and into xsdata for the source tree
+    edit_path = "../xsdata/" / path.relative_to(src)
+    mkdocs_gen_files.set_edit_path(full_doc_path, edit_path)
 
 
 with mkdocs_gen_files.open("api/SUMMARY.md", "w") as nav_file:
