From bc1f53df14e5440ca4ac9e8839367272818c5177 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Mon, 17 Aug 2026 18:22:15 -0400 Subject: [PATCH] Hotfix for sphinx-markdown compatibility --- yardang/sphinx/llms.py | 1 + yardang/tests/test_llms.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/yardang/sphinx/llms.py b/yardang/sphinx/llms.py index 7aa539d..c0d110d 100644 --- a/yardang/sphinx/llms.py +++ b/yardang/sphinx/llms.py @@ -33,6 +33,7 @@ class _MarkdownRenderer: name = "yardang-llms" format = "markdown" default_translator_class = _LlmsMarkdownTranslator + download_dir = "_downloads" def __init__(self, app: Sphinx): self.app = app diff --git a/yardang/tests/test_llms.py b/yardang/tests/test_llms.py index ff1ee29..eca2ef4 100644 --- a/yardang/tests/test_llms.py +++ b/yardang/tests/test_llms.py @@ -25,9 +25,13 @@ def _write_project(tmp_path: Path, *, full_build: bool = True) -> None: full-build = {str(full_build).lower()} """ ) - (tmp_path / "README.md").write_text("# Test Project\n\nProject overview.\n\nSee the [guide](guide.md).\n") + (tmp_path / "README.md").write_text( + "# Test Project\n\nProject overview.\n\nSee the [guide](guide.md).\n\n{download}`Download the sample `.\n" + ) (tmp_path / "guide.md").write_text("# Guide\n\nGuide summary for language models.\n\nReturn to the [overview](index.md).\n") (tmp_path / "orphan.md").write_text("# Orphan\n\nThis page is not in the toctree.\n") + (tmp_path / "files").mkdir(exist_ok=True) + (tmp_path / "files" / "sample.txt").write_text("sample\n") def test_generated_configuration_enables_yardang_llms(tmp_path, monkeypatch): @@ -68,6 +72,7 @@ def tracked_popen(command, *args, **kwargs): assert (output / "llms-full.txt").is_file() assert "(guide.html.md)" in (output / "index.html.md").read_text() assert "(index.html.md)" in (output / "guide.html.md").read_text() + assert "](_downloads/" in (output / "index.html.md").read_text() sitemap = (output / "llms.txt").read_text() assert sitemap.startswith("# Test Project\n\n> A project for LLMs\n")