docs(api[components]): Registry-aware docutils component reference#461
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #461 +/- ##
=======================================
Coverage 84.26% 84.26%
=======================================
Files 48 48
Lines 1487 1487
=======================================
Hits 1253 1253
Misses 234 234 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
7 tasks
tony
added a commit
to git-pull/gp-sphinx
that referenced
this pull request
Jun 7, 2026
Extend registry-aware autodoc from directives, roles, and config values to the whole docutils and Sphinx extension family, so every component a project ships gets the same polished, cross-linked reference card. Motivated by django-docutils, which documents a writer, translator, three transforms, and a custom node with plain automodule today. What's new: - **docutils components**: sphinx-autodoc-docutils gains autotransform, autoreader, autoparser, autowriter, autonode, and autotranslator — each with a single and a bulk-by-module directive — documenting transforms, readers, parsers, writers, custom nodes, and translators. - **Sphinx builders and domains**: sphinx-autodoc-sphinx gains autobuilder and autodomain alongside its config-value support. - **Cross-reference roles**: two new Sphinx domains, docutils and sphinxext, make every documented component linkable from prose, each with a grouped component index. - **Linked facts**: fact values that name a documented object — Python paths, translator classes, transform sets, handler overrides, config types, option validators, registering setup() entry points — render as cross-references that resolve locally or via intersphinx and degrade to plain chips where no target exists. List-valued facts render as individual chips; container config defaults render as Pygments-highlighted blocks. Design: - **Real ObjectDescription directives** per domain, so anchors, TOC entries, xref targets, and layout profiles come from Sphinx's own machinery rather than retagged markup. - **Graceful degradation as a contract**: linked literals carry refwarn-off pending_xrefs, so the same fact row is a live link where the inventory is mapped and a plain chip where it isn't. docutils ships no intersphinx inventory, so its internal names degrade by design. - **Recorder-replay discovery with module-scan fallback**: registered components surface real metadata; directly-instantiated ones are found by scanning. Discovery never raises at build time. Shared layer: build_linked_literal / build_chip_paragraph inline helpers and per-component layout profiles in sphinx-ux-autodoc-layout; per-type badge palette with a dark-block parity guard in sphinx-ux-badges; reference pages and demo-module autodoc sections so every fact target resolves on gp-sphinx's own site. Companion PR: tony/django-docutils#461 Closes #52
1cbad76 to
0b6a80d
Compare
0b6a80d to
7c103c0
Compare
why: The writer, translator, transforms, directive, and roles were documented only as plain automodule output. gp-sphinx's component autodoc renders each with its registry metadata — transform priorities, the writer's resolved translator class, the translator's own visit/depart overrides — and registers docutils-domain cross-reference targets prose can link to. what: - Add docs/api/lib/components.md covering every docutils component django-docutils ships: DjangoDocutilsWriter, DjangoDocutilsHTMLTranslator, CodeTransform, Contents, SanitizeTransform, CodeBlock, and the twelve role callables - Enable sphinx_autodoc_docutils and sphinx_autodoc_sphinx in conf.py extra_extensions; django-docutils registers nothing with Sphinx itself, so the docutils family is the complete inventory
why: The registry-aware component entries and the automodule pages documented the same objects with no path between them — a reader on lib.roles.github had no link to the role's registry entry, and the components page offered no route to full API docs. what: - Add a seealso on each component-bearing module page (writers, sanitize, both transforms, the code directive, and the eleven role pages) linking its registry-aware entries via domain roles - Add "Full API" backlinks from each components-page section to the matching automodule page
…ence why: docs/conf.py enables the sphinx_autodoc_docutils and sphinx_autodoc_sphinx extensions and docs/api/lib/components.md renders the docutils component reference through them; those packages must be installed for the docs build to import the extensions. gp-sphinx 0.0.1a29 publishes the component autodoc family on PyPI. what: - Pin sphinx-autodoc-docutils, sphinx-autodoc-sphinx, sphinx-ux-autodoc-layout, sphinx-ux-badges at ==0.0.1a29 (dev + docs groups) - Relock
7a87459 to
d078226
Compare
d078226 to
26028a4
Compare
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.
Summary
docs/api/lib/components.md— a registry-aware reference covering every docutils component django-docutils ships:DjangoDocutilsWriter,DjangoDocutilsHTMLTranslator, theCodeTransform/Contents/SanitizeTransformtransforms, the PygmentsCodeBlockdirective, and all twelve roles. Entries render with per-type kind badges and registry facts — transformdefault_priorityas an outlined badge, the writer's resolved translator class, and the translator's own visit/depart overrides (includingvisit_icon, the translator-handled-node case that motivated the upstream feature).sphinx_autodoc_docutilsandsphinx_autodoc_sphinxextensions and pin the component autodoc stack —sphinx-autodoc-docutils,sphinx-autodoc-sphinx,sphinx-ux-autodoc-layout,sphinx-ux-badges— at the released==0.0.1a29in the dev and docs dependency groups.api/lib/directives/code/→components/#directive-codeblock, role pages →#role-<name>, …), and each components-page section links back to the full API page.Companion
autowriter,autotranslator,autotransform(s),autodirective,autorole, and thedocutilscross-reference domain). Merged and shipped in gp-sphinx0.0.1a29, which this branch now pins directly from PyPI.Design decisions
sphinx_autodoc_sphinxenabled but inventory-empty: django-docutils registers nothing with Sphinx itself (no builders, domains, or config values) — the components page states this plainly so the docutils family reads as the complete inventory.github_role→github); prose notes that the names actually registered with docutils come from theDJANGO_DOCUTILS_LIB_RSTrolesmapping.Test plan
cd docs && just htmlbuilds clean with the released0.0.1a29autodoc stack installed; the components page renders the per-type kind badges, the transform priority badge, and the translatorOverridesfact list (own handlers only)uv lock --checkconsistent; all four packages resolve to0.0.1a29from PyPI with no prerelease warnings