epythet.agent_outputs¶
Agent-facing outputs: llms.txt, Markdown twins, link relations, aggregates.
Humans get the rendered HTML. Agents get, from the same build:
llms.txt: an index of every page with a one-line description, and<page>.mdtwins of every page, both produced by thesphinx_llm.txtextension (which drives a second, Markdown build).<link rel="alternate" type="text/markdown">and<link rel="describedby" href="llms.txt">in every HTML page’s<head>, the llms.txt discovery contract. The plugin does not add these; thehtml-page-contexthook here does.objects.inv: the Sphinx inventory, already a machine-readable symbol index.Aggregates: one flat document with the whole site, at a stable URL at the site root:
<package>.md(from the Markdown build’s concatenation) and, when a renderer is available,<package>.pdf. Seewrite_aggregates().
The aggregates seam is the aggregates key of the configuration:
["md"] by default, ["md", "pdf"] when a PDF is wanted.
Module Attributes
File the Markdown build writes when |
Functions
|
|
|
Add the link relations to every built page that has a Markdown twin but no tag. |
|
The two |
|
Render a Markdown file to PDF, without LaTeX. |
|
The Sphinx configuration values for the agent outputs. |
|
Produce the flat single-document twins at the root of a built site. |
- epythet.agent_outputs.LLMS_FULL_TXT = 'llms-full.txt'¶
File the Markdown build writes when
llms_txt_full_buildis on.
- epythet.agent_outputs.inject_link_relations(app, pagename, templatename, context, doctree)[source]¶
html-page-contexthook: advertise the Markdown twin andllms.txt.
- epythet.agent_outputs.inject_link_relations_into_site(html_dir)[source]¶
Add the link relations to every built page that has a Markdown twin but no tag.
Themes that do not render Sphinx’s
metatagsblock (shibuya) get nothing from thehtml-page-contexthook; this post-build pass covers them. Returns the number of files changed.- Return type:
- epythet.agent_outputs.link_relation_tags(pagename)[source]¶
The two
<link>tags for a page, with hrefs relative to that page.- Return type:
>>> print(link_relation_tags("_autosummary/pkg.mod")) <link rel="alternate" type="text/markdown" href="pkg.mod.html.md"> <link rel="describedby" href="../llms.txt" type="text/markdown">
- epythet.agent_outputs.markdown_to_pdf(md_path, pdf_path)[source]¶
Render a Markdown file to PDF, without LaTeX.
Tries, in order: Playwright (Chromium print-to-PDF, best fidelity) and WeasyPrint. Returns
None, with a printed notice, when neither is installed.
- epythet.agent_outputs.sphinx_settings(*, description='')[source]¶
The Sphinx configuration values for the agent outputs.
llms_txt_full_buildstays on because its concatenation is the<pkg>.mdaggregate;write_aggregates()renames it after the build.- Return type:
- epythet.agent_outputs.write_aggregates(html_dir, *, package_name, aggregates=('md',))[source]¶
Produce the flat single-document twins at the root of a built site.
- Parameters:
- Return type:
- Returns:
the files written, keyed by kind
The
.mdaggregate is the Markdown build’sllms-full.txtrenamed, andllms.txtis rewritten to point at it. The.pdfaggregate is rendered from the.mdone bymarkdown_to_pdf(), which needs an optional renderer; when none is installed the PDF is skipped with a notice.