Skip to content

Commit 96c33e3

Browse files
flsh86claude
andauthored
Add sphinx-llms-txt to generate llms.txt and llms-full.txt (#463)
## 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://ox.softwaremill.com/latest/llms.txt - https://ox.softwaremill.com/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 6dd5cdc commit 96c33e3

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
@@ -29,3 +29,7 @@ metals.sbt
2929
# TraceVault — local only, do not commit
3030
.tracevault/
3131
.claude/settings.local.json
32+
33+
# Local Sphinx build artifacts
34+
generated-doc/out/.venv/
35+
generated-doc/out/_build/

doc/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://ox.softwaremill.com/latest/",
30+
)
2831

2932
# Tell Jinja2 templates the build is running on Read the Docs
3033
if os.environ.get("READTHEDOCS", "") == "True":
@@ -41,7 +44,11 @@
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']
48+
49+
llms_txt_title = "Ox"
50+
llms_txt_summary = "Safe direct-style concurrency and resiliency for Scala on the JVM"
51+
llms_txt_full_file = True
4552

4653
# Add any paths that contain templates here, relative to this directory.
4754
templates_path = ['_templates']
@@ -52,7 +59,6 @@
5259
# source_suffix = ['.rst', '.md']
5360
source_suffix = {
5461
'.rst': 'restructuredtext',
55-
'.txt': 'markdown',
5662
'.md': 'markdown',
5763
}
5864

@@ -83,7 +89,15 @@
8389
# List of patterns, relative to source directory, that match files and
8490
# directories to ignore when looking for source files.
8591
# This patterns also effect to html_static_path and html_extra_path
86-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
92+
exclude_patterns = [
93+
'_build', 'Thumbs.db', '.DS_Store',
94+
'.venv', 'venv', 'env',
95+
'**/site-packages/**',
96+
'**/node_modules/**',
97+
'_templates',
98+
'requirements.txt',
99+
'includes/*',
100+
]
87101

88102
# The name of the Pygments (syntax highlighting) style to use.
89103
pygments_style = 'sphinx'

doc/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-doc/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://ox.softwaremill.com/latest/",
30+
)
2831

2932
# Tell Jinja2 templates the build is running on Read the Docs
3033
if os.environ.get("READTHEDOCS", "") == "True":
@@ -41,7 +44,11 @@
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']
48+
49+
llms_txt_title = "Ox"
50+
llms_txt_summary = "Safe direct-style concurrency and resiliency for Scala on the JVM"
51+
llms_txt_full_file = True
4552

4653
# Add any paths that contain templates here, relative to this directory.
4754
templates_path = ['_templates']
@@ -52,7 +59,6 @@
5259
# source_suffix = ['.rst', '.md']
5360
source_suffix = {
5461
'.rst': 'restructuredtext',
55-
'.txt': 'markdown',
5662
'.md': 'markdown',
5763
}
5864

@@ -83,7 +89,15 @@
8389
# List of patterns, relative to source directory, that match files and
8490
# directories to ignore when looking for source files.
8591
# This patterns also effect to html_static_path and html_extra_path
86-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
92+
exclude_patterns = [
93+
'_build', 'Thumbs.db', '.DS_Store',
94+
'.venv', 'venv', 'env',
95+
'**/site-packages/**',
96+
'**/node_modules/**',
97+
'_templates',
98+
'requirements.txt',
99+
'includes/*',
100+
]
87101

88102
# The name of the Pygments (syntax highlighting) style to use.
89103
pygments_style = 'sphinx'

generated-doc/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)