From ded5bb215398e38e9fcb15b19986702bbd309efd Mon Sep 17 00:00:00 2001 From: Jacob Tomlinson Date: Mon, 13 Oct 2025 10:54:59 +0100 Subject: [PATCH 1/2] Check markdown build status and exit with error --- src/sphinx_llm/txt.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sphinx_llm/txt.py b/src/sphinx_llm/txt.py index 3d2a247..cc6e6eb 100644 --- a/src/sphinx_llm/txt.py +++ b/src/sphinx_llm/txt.py @@ -72,6 +72,10 @@ def generate_markdown_files(self, app: Sphinx, exception: Union[Exception, None] # Build the markdown files md_app.build() + if md_app.statuscode != 0: + logger.error("Failed to generate markdown files for llms.txt") + return + # Find all markdown files in the build directory md_files = list(md_build_dir.rglob("*.md")) self.generated_markdown_files = [] From 0617b75316f7fd5706fc07015474985a46c7db70 Mon Sep 17 00:00:00 2001 From: Jacob Tomlinson Date: Mon, 13 Oct 2025 10:59:05 +0100 Subject: [PATCH 2/2] Improve error --- src/sphinx_llm/txt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sphinx_llm/txt.py b/src/sphinx_llm/txt.py index cc6e6eb..c22aab7 100644 --- a/src/sphinx_llm/txt.py +++ b/src/sphinx_llm/txt.py @@ -73,7 +73,9 @@ def generate_markdown_files(self, app: Sphinx, exception: Union[Exception, None] md_app.build() if md_app.statuscode != 0: - logger.error("Failed to generate markdown files for llms.txt") + logger.error( + "Failed to generate markdown files for llms.txt. For more details run the markdown builder manually. Command: sphinx-build -b markdown " + ) return # Find all markdown files in the build directory