Skip to content

Commit 46ffa31

Browse files
flsh86claude
andauthored
Add llms.txt docs (#2925)
## Summary Adds [`sphinx-llms-txt`](https://github.com/jdillard/sphinx-llms-txt) to the Sphinx documentation build so that `llms.txt` and `llms-full.txt` are generated automatically alongside the existing HTML output. [`llms.txt`](https://llmstxt.org) is a standard for making documentation consumable by LLMs — `llms.txt` is a structured index of doc pages with links, and `llms-full.txt` is the full documentation concatenated into a single plain-text file. Once merged, the files will be served at: - https://sttp.softwaremill.com/en/latest/llms.txt - https://sttp.softwaremill.com/en/latest/llms-full.txt ## Changes - `doc/requirements.txt` / `generated-doc/out/requirements.txt` — add `sphinx-llms-txt` - `doc/conf.py` / `generated-doc/out/conf.py`: - Add `sphinx_llms_txt` extension with title, summary, and `llms-full.txt` enabled - Remove `.txt` from `source_suffix` (was causing `requirements.txt` to appear as a doc page) - Tighten `exclude_patterns` to prevent venv, node_modules, `_templates`, `includes/*` partials, and `requirements.txt` from being treated as source documents - Add fallback to `html_baseurl` so local builds also produce absolute links No changes to `.readthedocs.yaml` - ReadTheDocs already installs from `generated-doc/out/requirements.txt` and runs Sphinx on `generated-doc/out/conf.py`, so the new files will be generated on every ReadTheDocs build automatically. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6595927 commit 46ffa31

5 files changed

Lines changed: 42 additions & 8 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ work.txt
4242
# TraceVault — local only, do not commit
4343
.tracevault/
4444
.claude/settings.local.json
45+
46+
# Local Sphinx build artifacts
47+
generated-docs/out/.venv/
48+
generated-docs/out/_build/

docs/conf.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
import os
2525

2626
# Define the canonical URL if you are using a custom domain on Read the Docs
27-
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
27+
html_baseurl = os.environ.get(
28+
"READTHEDOCS_CANONICAL_URL",
29+
"https://sttp.softwaremill.com/en/latest/",
30+
)
2831

2932
# Tell Jinja2 templates the build is running on Read the Docs
3033
if os.environ.get("READTHEDOCS", "") == "True":
@@ -41,10 +44,14 @@
4144
# Add any Sphinx extension module names here, as strings. They can be
4245
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4346
# ones.
44-
extensions = ['myst_parser', 'sphinx_rtd_theme']
47+
extensions = ['myst_parser', 'sphinx_rtd_theme', 'sphinx_llms_txt']
4548

4649
myst_enable_extensions = ['attrs_block']
4750

51+
llms_txt_title = "sttp"
52+
llms_txt_summary = "The Scala HTTP client you always wanted!"
53+
llms_txt_full_file = True
54+
4855
# Add any paths that contain templates here, relative to this directory.
4956
templates_path = ['_templates']
5057

@@ -54,7 +61,6 @@
5461
# source_suffix = ['.rst', '.md']
5562
source_suffix = {
5663
'.rst': 'restructuredtext',
57-
'.txt': 'markdown',
5864
'.md': 'markdown',
5965
}
6066

@@ -85,7 +91,15 @@
8591
# List of patterns, relative to source directory, that match files and
8692
# directories to ignore when looking for source files.
8793
# This patterns also effect to html_static_path and html_extra_path
88-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
94+
exclude_patterns = [
95+
'_build', 'Thumbs.db', '.DS_Store',
96+
'.venv', 'venv', 'env',
97+
'**/site-packages/**',
98+
'**/node_modules/**',
99+
'_templates',
100+
'requirements.txt',
101+
'includes/*',
102+
]
89103

90104
# The name of the Pygments (syntax highlighting) style to use.
91105
pygments_style = 'default'

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ sphinx_rtd_theme==2.0.0
22
sphinx==7.3.7
33
sphinx-autobuild==2024.4.16
44
myst-parser==2.0.0
5+
sphinx-llms-txt

generated-docs/out/conf.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
import os
2525

2626
# Define the canonical URL if you are using a custom domain on Read the Docs
27-
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
27+
html_baseurl = os.environ.get(
28+
"READTHEDOCS_CANONICAL_URL",
29+
"https://sttp.softwaremill.com/en/latest/",
30+
)
2831

2932
# Tell Jinja2 templates the build is running on Read the Docs
3033
if os.environ.get("READTHEDOCS", "") == "True":
@@ -41,10 +44,14 @@
4144
# Add any Sphinx extension module names here, as strings. They can be
4245
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4346
# ones.
44-
extensions = ['myst_parser', 'sphinx_rtd_theme']
47+
extensions = ['myst_parser', 'sphinx_rtd_theme', 'sphinx_llms_txt']
4548

4649
myst_enable_extensions = ['attrs_block']
4750

51+
llms_txt_title = "sttp"
52+
llms_txt_summary = "The Scala HTTP client you always wanted!"
53+
llms_txt_full_file = True
54+
4855
# Add any paths that contain templates here, relative to this directory.
4956
templates_path = ['_templates']
5057

@@ -54,7 +61,6 @@
5461
# source_suffix = ['.rst', '.md']
5562
source_suffix = {
5663
'.rst': 'restructuredtext',
57-
'.txt': 'markdown',
5864
'.md': 'markdown',
5965
}
6066

@@ -85,7 +91,15 @@
8591
# List of patterns, relative to source directory, that match files and
8692
# directories to ignore when looking for source files.
8793
# This patterns also effect to html_static_path and html_extra_path
88-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
94+
exclude_patterns = [
95+
'_build', 'Thumbs.db', '.DS_Store',
96+
'.venv', 'venv', 'env',
97+
'**/site-packages/**',
98+
'**/node_modules/**',
99+
'_templates',
100+
'requirements.txt',
101+
'includes/*',
102+
]
89103

90104
# The name of the Pygments (syntax highlighting) style to use.
91105
pygments_style = 'default'

generated-docs/out/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ sphinx_rtd_theme==2.0.0
22
sphinx==7.3.7
33
sphinx-autobuild==2024.4.16
44
myst-parser==2.0.0
5+
sphinx-llms-txt

0 commit comments

Comments
 (0)