You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-11
Original file line number
Diff line number
Diff line change
@@ -22,30 +22,71 @@ pip install mkdocs-llmstxt
22
22
Enable the plugin in `mkdocs.yml`:
23
23
24
24
```yaml title="mkdocs.yml"
25
+
site_name: My project
26
+
site_description: Description of my project.
27
+
site_url: https://myproject.com/ # Required for the llmstxt plugin to work.
28
+
25
29
plugins:
26
30
- llmstxt:
27
-
files:
28
-
- output: llms.txt
29
-
inputs:
31
+
markdown_description: Long description of my project.
32
+
sections:
33
+
Usage documentation:
30
34
- file1.md
31
-
- folder/file2.md
35
+
- file2.md
36
+
```
37
+
38
+
The resulting `/llms.txt` file will be available at the root of your documentation. With the previous example, it will be accessible at https://myproject.com/llms.txt and will contain the following:
39
+
40
+
```markdown
41
+
# My project
42
+
43
+
> Description of my project.
44
+
45
+
Long description of my project.
46
+
47
+
## Usage documentation
48
+
49
+
- [File1 title](https://myproject.com/file1.md)
50
+
- [File2 title](https://myproject.com/file2.md)
32
51
```
33
52
34
-
You can generate several files, each from its own set of input files.
53
+
Each source file included in `sections` will have its own Markdown file available at the specified URL in the `/llms.txt`. See [Markdown generation](#markdown-generation) for more details.
35
54
36
55
File globbing is supported:
37
56
38
57
```yaml title="mkdocs.yml"
39
58
plugins:
40
59
- llmstxt:
41
-
files:
42
-
- output: llms.txt
43
-
inputs:
44
-
- file1.md
45
-
- reference/*/*.md
60
+
sections:
61
+
Usage documentation:
62
+
- index.md
63
+
- usage/*.md
46
64
```
47
65
48
-
The plugin will concatenate the rendered HTML of these input pages, clean it up a bit (with [BeautifulSoup](https://pypi.org/project/beautifulsoup4/)), convert it back to Markdown (with [Markdownify](https://pypi.org/project/markdownify)), and format it (with [Mdformat](https://pypi.org/project/mdformat)). By concatenating HTML instead of Markdown, we ensure that dynamically generated contents (API documentation, executed code blocks, snippets from other files, Jinja macros, etc.) are part of the generated text files. Credits to [Petyo Ivanov](https://github.com/petyosi) for the original idea ✨
66
+
## Full output
67
+
68
+
Although not explicitly written out in the https://llmstxt.org/ guidelines, it is common to output a `llms-full.txt` file with every page content expanded. This file can be generated by setting the `full_output` configuration value:
69
+
70
+
```markdown
71
+
plugins:
72
+
- llmstxt:
73
+
full_output: llms-full.txt
74
+
sections:
75
+
Usage documentation:
76
+
- index.md
77
+
- usage/*.md
78
+
```
79
+
80
+
## Markdown generation
81
+
82
+
To generate a Markdown page from a source file, the plugin will:
83
+
84
+
- Cleanup the HTML output (with [BeautifulSoup](https://pypi.org/project/beautifulsoup4/))
85
+
- Convert it back to Markdown (with [Markdownify](https://pypi.org/project/markdownify))
86
+
87
+
Doing so is necessary to ensure that dynamically generated contents (API documentation, executed code blocks, snippets from other files, Jinja macros, etc.) are part of the generated text files.
88
+
89
+
Credits to [Petyo Ivanov](https://github.com/petyosi) for the original idea ✨.
0 commit comments