AI accessibility: per-page Markdown and llms.txt#5
Merged
Conversation
Opt-in `llms` config block serves a clean Markdown rendition of every page (append `.md`, or `Accept: text/markdown`), a generated `/llms.txt` index, and `Link`/`X-Llms-Txt` discovery headers. A page's Markdown is resolved from the project: a co-located `<page>.md`, a `to_markdown` handler in the page module, or a `to_markdown` in the nearest-ancestor `llms.py` (subtree scope; `pages/llms.py` is app-wide), with an opt-in dependency-free HTML->markdown `autoConvert` fallback and a redirect otherwise. A `wrap_markdown` hook frames every `.md`; a `llms_txt` hook generates the index. Handlers receive a `MarkdownContext` exposing `request`, `path`, `run_loader()`, and `render_html()`. Off by default; adds nothing to the page hot path. Bumps 0.5.0 -> 0.6.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI accessibility — serve your app as Markdown
Opt-in
llmsfeature: every page is available as clean Markdown (append.md, or sendAccept: text/markdown), plus a generated/llms.txtindex andLink/X-Llms-Txtdiscovery headers. Off by default; no page hot-path cost.Where the Markdown comes from (first hit wins): a co-located
<page>.md→ ato_markdownhandler in the page module → ato_markdownin the nearest-ancestorllms.py(subtree scope;pages/llms.pyis app-wide) → opt-in dependency-free HTML→markdownautoConvert→ a redirect to the page.wrap_markdown(ctx, md)frames every.mdwith a header/footer;llms_txt(ctx)generates the index.MarkdownContextwithrequest,path,run_loader(), andrender_html().Docs: new AI accessibility guide, runtime-API reference for the hooks + context objects, and the config reference. Bumps 0.5.0 → 0.6.0.
Tests:
tests/devserver/test_llms.pyplus config and route tests; full suite green, coverage ≥ 95%.