Name | mkdocs-llmstxt JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | MkDocs plugin to generate an /llms.txt file. |
upload_time | 2025-01-14 18:15:16 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | ISC |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# mkdocs-llmstxt
[![ci](https://github.com/pawamoy/mkdocs-llmstxt/workflows/ci/badge.svg)](https://github.com/pawamoy/mkdocs-llmstxt/actions?query=workflow%3Aci)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/mkdocs-llmstxt/)
[![pypi version](https://img.shields.io/pypi/v/mkdocs-llmstxt.svg)](https://pypi.org/project/mkdocs-llmstxt/)
[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#mkdocs-llmstxt:gitter.im)
MkDocs plugin to generate an [/llms.txt file](https://llmstxt.org/).
> /llms.txt - A proposal to standardise on using an /llms.txt file to provide information to help LLMs use a website at inference time.
See our own dynamically generated [/llms.txt](llms.txt) as a demonstration.
## Installation
```bash
pip install mkdocs-llmstxt
```
## Usage
Enable the plugin in `mkdocs.yml`:
```yaml title="mkdocs.yml"
plugins:
- llmstxt:
files:
- output: llms.txt
inputs:
- file1.md
- folder/file2.md
```
You can generate several files, each from its own set of input files.
File globbing is supported:
```yaml title="mkdocs.yml"
plugins:
- llmstxt:
files:
- output: llms.txt
inputs:
- file1.md
- reference/*/*.md
```
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 ✨
You can disable auto-cleaning of the HTML:
```yaml title="mkdocs.yml"
plugins:
- llmstxt:
autoclean: false
```
You can also pre-process the HTML before it is converted back to Markdown:
```yaml title="mkdocs.yml"
plugins:
- llmstxt:
preprocess: path/to/script.py
```
The specified `script.py` must expose a `preprocess` function that accepts the `soup` and `output` arguments:
```python
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from bs4 import BeautifulSoup
def preprocess(soup: BeautifulSoup, output: str) -> None:
... # modify the soup
```
The `output` argument lets you modify the soup *depending on which file is being generated*.
Have a look at [our own pre-processing function](https://pawamoy.github.io/mkdocs-llmstxt/reference/mkdocs_llmstxt/preprocess/#mkdocs_llmstxt.preprocess.autoclean) to get inspiration.
Raw data
{
"_id": null,
"home_page": null,
"name": "mkdocs-llmstxt",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "=?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>",
"download_url": "https://files.pythonhosted.org/packages/56/b1/2c5b7a36dcb5e8cc9e220dc8c9eb5407be1d1a09d869275a46da9a808d5d/mkdocs_llmstxt-0.1.0.tar.gz",
"platform": null,
"description": "# mkdocs-llmstxt\n\n[![ci](https://github.com/pawamoy/mkdocs-llmstxt/workflows/ci/badge.svg)](https://github.com/pawamoy/mkdocs-llmstxt/actions?query=workflow%3Aci)\n[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/mkdocs-llmstxt/)\n[![pypi version](https://img.shields.io/pypi/v/mkdocs-llmstxt.svg)](https://pypi.org/project/mkdocs-llmstxt/)\n[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#mkdocs-llmstxt:gitter.im)\n\nMkDocs plugin to generate an [/llms.txt file](https://llmstxt.org/).\n\n> /llms.txt - A proposal to standardise on using an /llms.txt file to provide information to help LLMs use a website at inference time. \n\nSee our own dynamically generated [/llms.txt](llms.txt) as a demonstration.\n\n## Installation\n\n```bash\npip install mkdocs-llmstxt\n```\n\n## Usage\n\nEnable the plugin in `mkdocs.yml`:\n\n```yaml title=\"mkdocs.yml\"\nplugins:\n- llmstxt:\n files:\n - output: llms.txt\n inputs:\n - file1.md\n - folder/file2.md\n```\n\nYou can generate several files, each from its own set of input files.\n\nFile globbing is supported:\n\n```yaml title=\"mkdocs.yml\"\nplugins:\n- llmstxt:\n files:\n - output: llms.txt\n inputs:\n - file1.md\n - reference/*/*.md\n```\n\nThe 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 \u2728\n\nYou can disable auto-cleaning of the HTML:\n\n```yaml title=\"mkdocs.yml\"\nplugins:\n- llmstxt:\n autoclean: false\n```\n\nYou can also pre-process the HTML before it is converted back to Markdown:\n\n```yaml title=\"mkdocs.yml\"\nplugins:\n- llmstxt:\n preprocess: path/to/script.py\n```\n\nThe specified `script.py` must expose a `preprocess` function that accepts the `soup` and `output` arguments:\n\n```python\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n from bs4 import BeautifulSoup\n\ndef preprocess(soup: BeautifulSoup, output: str) -> None:\n ... # modify the soup\n```\n\nThe `output` argument lets you modify the soup *depending on which file is being generated*.\n\nHave a look at [our own pre-processing function](https://pawamoy.github.io/mkdocs-llmstxt/reference/mkdocs_llmstxt/preprocess/#mkdocs_llmstxt.preprocess.autoclean) to get inspiration.\n",
"bugtrack_url": null,
"license": "ISC",
"summary": "MkDocs plugin to generate an /llms.txt file.",
"version": "0.1.0",
"project_urls": {
"Changelog": "https://pawamoy.github.io/mkdocs-llmstxt/changelog",
"Discussions": "https://github.com/pawamoy/mkdocs-llmstxt/discussions",
"Documentation": "https://pawamoy.github.io/mkdocs-llmstxt",
"Funding": "https://github.com/sponsors/pawamoy",
"Gitter": "https://gitter.im/mkdocs-llmstxt/community",
"Homepage": "https://pawamoy.github.io/mkdocs-llmstxt",
"Issues": "https://github.com/pawamoy/mkdocs-llmstxt/issues",
"Repository": "https://github.com/pawamoy/mkdocs-llmstxt"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "588019ba3d680da50a6e2b09deaeedc004ed6bac3615f0ff68112e3f785b7c98",
"md5": "834e867341b9303115c814070f3b7eac",
"sha256": "893870a0060d0fc0690f03a519652932929225499cbacd6377e45e0c48041865"
},
"downloads": -1,
"filename": "mkdocs_llmstxt-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "834e867341b9303115c814070f3b7eac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 21774,
"upload_time": "2025-01-14T18:15:14",
"upload_time_iso_8601": "2025-01-14T18:15:14.867985Z",
"url": "https://files.pythonhosted.org/packages/58/80/19ba3d680da50a6e2b09deaeedc004ed6bac3615f0ff68112e3f785b7c98/mkdocs_llmstxt-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "56b12c5b7a36dcb5e8cc9e220dc8c9eb5407be1d1a09d869275a46da9a808d5d",
"md5": "c191f907bfc8f42107d6b5ddb2cac720",
"sha256": "6e77bd5b4ecdc57cba9a92faceab5ba4cdffa4d2a0a78ebc1823ca3cde3fc108"
},
"downloads": -1,
"filename": "mkdocs_llmstxt-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "c191f907bfc8f42107d6b5ddb2cac720",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 37414,
"upload_time": "2025-01-14T18:15:16",
"upload_time_iso_8601": "2025-01-14T18:15:16.500773Z",
"url": "https://files.pythonhosted.org/packages/56/b1/2c5b7a36dcb5e8cc9e220dc8c9eb5407be1d1a09d869275a46da9a808d5d/mkdocs_llmstxt-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-14 18:15:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pawamoy",
"github_project": "mkdocs-llmstxt",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mkdocs-llmstxt"
}