Add ability to publish our docs in markdown format#3097
Conversation
Add sphinx-markdown-builder to produce .md files alongside HTML output. Agents and LLMs can consume docs at /2.0/markdown/<path>.md without HTML parsing overhead. - Add sphinx-markdown-builder dependency to pyproject.toml - Register sphinx_markdown_builder extension in conf.py - Add md1/md2/markdown/merge-markdown Makefile targets - Update llms.txt generator to point to markdown URLs - Add link tag to landing page for llms.txt discovery - Fix deprecated app.warn in redirects extension for non-HTML builders - Add custom node handlers for tip/danger/caution/admonition directives
|
This pull request does not contain a staged changelog entry. To create one, use the Make sure that the description is appropriate for a changelog entry and that the proper feature type is used. See |
Add handlers for productionlist (rendered as code blocks), caption (rendered as bold text), hlist/hlistcol (pass-through to children), and label (properly differentiate footnote labels from tab labels). Also fix admonition depart handlers to properly pop context.
bd09b69 to
bea3596
Compare
| /> | ||
|
|
||
| <title>Smithy</title> | ||
| <link |
There was a problem hiding this comment.
This allows implicit discovery if an LLM or agent comes across the documentation through our HTML pages
|
Why not just convert all the source to markdown? Some of our pages already use it. That would make offboarding to some other thing easier |
Hmm, my intention was to make it additive as a change. Would we lose those !TIP and !IMPORTANT sections if we move away from .rst? What about we ship this so we get benefit right away for the intention of providing value right now with current conversion and then convert in batches to |
Background
This adds markdown versions of all documentation pages alongside the existing HTML output. AI agents and LLMs can now consume Smithy docs directly at
/2.0/markdown/<path>.mdwithout parsing HTML, which is more token-efficient and eliminates the need to navigate through<div>tags and CSS classes to find actual content.The
llms.txtindex is updated to point to markdown URLs so agents can programmatically discover all available content. A<link rel="alternate">tag is added to the landing page so agents parsingsmithy.iocan findllms.txtwithout guessing paths.This also fixes a pre-existing crash in
redirects.pywhereapp.warn(deprecated in 1.6, removed in 2.0) caused the build to fail when using any non-HTML builder. Custom node handlers are added fortip,danger,caution, andadmonitiondirectives so their content is preserved in the markdown output rather than silently dropped.Testing
Built locally with Python 3.12. The markdown builder produces 123 files for Smithy 2.0 and 56 for 1.0. Code blocks, tables, cross-references, and links all render correctly. The HTML build continues to work unchanged.
Links
/llms.txtdiscoveryapp.warnremoval referencellms.txtgeneration