Generate llms.txt from built HTML documentation
Project description
llmstxt-standalone
Generate /llms.txt, /llms-full.txt, and per-page markdown files from built HTML documentation, following the llms.txt spec.
This tool works on pre-built HTML, making it useful for environments that cannot run MkDocs plugins (e.g., Zensical) or when you want llms.txt generation as a separate build step. For standard MkDocs workflows, see mkdocs-llmstxt.
Installation
Requires Python 3.10+.
# Run without installing
uvx llmstxt-standalone
# Install as a CLI tool
uv tool install llmstxt-standalone # or: pipx install
# Add to a project
uv add llmstxt-standalone # or: pip install
Usage
build
Generate llms.txt from a built MkDocs site:
# Run from project root (expects mkdocs.yml and site/)
llmstxt-standalone build
# Explicit paths
llmstxt-standalone build --config mkdocs.yml --site-dir ./build --output-dir ./dist
# Preview without writing files
llmstxt-standalone build --dry-run
# Suppress output
llmstxt-standalone build --quiet
# Show detailed progress
llmstxt-standalone build --verbose
| Option | Short | Default | Description |
|---|---|---|---|
--config |
-c |
mkdocs.yml |
Path to MkDocs config file |
--site-dir |
-s |
site |
Path to built HTML directory |
--output-dir |
-o |
same as site-dir | Where to write output files |
--dry-run |
-n |
Preview without writing | |
--quiet |
-q |
Suppress output | |
--verbose |
-v |
Show detailed progress |
init
Add llmstxt plugin configuration to an existing mkdocs.yml:
llmstxt-standalone init
# Specify config path
llmstxt-standalone init --config path/to/mkdocs.yml
# Overwrite existing llmstxt config
llmstxt-standalone init --force
# Show detailed progress
llmstxt-standalone init --verbose
| Option | Short | Description |
|---|---|---|
--config |
-c |
Path to mkdocs.yml (default: mkdocs.yml) |
--force |
-f |
Overwrite existing llmstxt section |
--quiet |
-q |
Suppress output |
--verbose |
-v |
Show detailed progress |
validate
Check that a config file is valid:
$ llmstxt-standalone validate
Config valid: mkdocs.yml
Site: My Project
Sections: 3
Pages: 12
# Exit code only (for scripts)
llmstxt-standalone validate --quiet
# Show section details
llmstxt-standalone validate --verbose
| Option | Short | Description |
|---|---|---|
--config |
-c |
Path to mkdocs.yml (default: mkdocs.yml) |
--quiet |
-q |
Suppress output |
--verbose |
-v |
Show detailed config information |
Global options
llmstxt-standalone --version # Show version
llmstxt-standalone --help # Show available commands
Output
The build command generates three outputs:
llms.txt— an index file with markdown links to all pagesllms-full.txt— concatenated content of all pages- Per-page
.mdfiles alongside the HTML
The per-page markdown files make the URLs in llms.txt resolve to actual content. If your site is at https://docs.example.com/, the URL https://docs.example.com/install/index.md returns markdown instead of HTML.
Configuration
The tool reads your mkdocs.yml for site metadata. You can configure llmstxt output explicitly or let it derive structure from your nav.
Explicit configuration
plugins:
- llmstxt:
markdown_description: |
Extra context for LLMs about your project.
full_output: llms-full.txt
content_selector: article.md-content__inner
sections:
Getting Started:
- index.md
- install.md
Usage:
- guide/basics.md
- guide/advanced.md
| Option | Default | Description |
|---|---|---|
markdown_description |
"" |
Additional context for LLMs, appears after site description |
full_output |
llms-full.txt |
Filename for concatenated content |
content_selector |
auto-detect | CSS selector for main content |
sections |
derived from nav | Section names mapped to page lists |
Automatic fallback
Without an explicit llmstxt plugin config, sections derive from your nav structure. Top-level pages go into a "Pages" section; nested nav items become sections named by their keys.
MkDocs settings
The tool respects use_directory_urls from your mkdocs.yml. When enabled (the default), install.md maps to install/index.md; when disabled, it maps to install.md.
Content extraction
If content_selector is not set, the tool tries these selectors in order:
.md-content__inner(Material for MkDocs)[role="main"](default MkDocs theme)articlemain- The entire document
Title resolution
Page titles resolve in this order:
- The title from your
navstructure - The HTML
<title>tag (with site name suffix stripped) - The first
<h1>tag - A title derived from the filename
Programmatic use
from pathlib import Path
from llmstxt_standalone.config import load_config
from llmstxt_standalone.generate import generate_llms_txt
config = load_config(Path("mkdocs.yml"))
result = generate_llms_txt(config, site_dir=Path("site"))
print(result.llms_txt) # Index content
print(result.llms_full_txt) # Full content
print(result.markdown_files) # List of written .md paths
Compatibility
- Produces output identical to mkdocs-llmstxt when configured the same way
- Handles Unicode, international characters, and special characters
- Works with Material for MkDocs, ReadTheDocs, and the default MkDocs theme
- Parses configs containing Python YAML tags like
!python/object/apply
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmstxt_standalone-0.2.0.tar.gz.
File metadata
- Download URL: llmstxt_standalone-0.2.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dadbd6a51dcb7b2f7bacc289a2f0a64833b8d161f70127b76c7550ace877be3
|
|
| MD5 |
a64c5e0637f805864bca756148967874
|
|
| BLAKE2b-256 |
d9f43335a699ff42daed5c9504078fd6518e87d4541b521658d063a4ac277105
|
Provenance
The following attestation bundles were made for llmstxt_standalone-0.2.0.tar.gz:
Publisher:
release.yml on shaanmajid/llmstxt-standalone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmstxt_standalone-0.2.0.tar.gz -
Subject digest:
9dadbd6a51dcb7b2f7bacc289a2f0a64833b8d161f70127b76c7550ace877be3 - Sigstore transparency entry: 909529086
- Sigstore integration time:
-
Permalink:
shaanmajid/llmstxt-standalone@dca10fddd68761e3a1acd104cbc97dd0ee4b1e7d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shaanmajid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dca10fddd68761e3a1acd104cbc97dd0ee4b1e7d -
Trigger Event:
push
-
Statement type:
File details
Details for the file llmstxt_standalone-0.2.0-py3-none-any.whl.
File metadata
- Download URL: llmstxt_standalone-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60b34f11386a6962462f6411c36e3e0751c7a8f1d75dd7465b693bccdba9ebdb
|
|
| MD5 |
0823f022e1547ede4452fc501e4f1652
|
|
| BLAKE2b-256 |
9b3be08ffd9c469e5fa649051e9618d0f1c765b307cc14f43c108ec8d1006b80
|
Provenance
The following attestation bundles were made for llmstxt_standalone-0.2.0-py3-none-any.whl:
Publisher:
release.yml on shaanmajid/llmstxt-standalone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmstxt_standalone-0.2.0-py3-none-any.whl -
Subject digest:
60b34f11386a6962462f6411c36e3e0751c7a8f1d75dd7465b693bccdba9ebdb - Sigstore transparency entry: 909529081
- Sigstore integration time:
-
Permalink:
shaanmajid/llmstxt-standalone@dca10fddd68761e3a1acd104cbc97dd0ee4b1e7d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shaanmajid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dca10fddd68761e3a1acd104cbc97dd0ee4b1e7d -
Trigger Event:
push
-
Statement type: