Sphinx extension to render Java API docs from XML doclet output, with OpenJDK cross-links
Project description
sphinx-javadoc-xml
A Sphinx extension that renders Java API documentation from an XML doclet output in a JavaDoc-inspired style — fully integrated with your Sphinx theme, with cross-links to OpenJDK Javadoc and between all defined types.
Features
- Full XML doclet support: classes, interfaces, enums, methods, fields, constructors, annotations, type parameters, bounded wildcards, exceptions
- OpenJDK cross-links:
java.util.Listbecomes a clickable link to the Oracle JDK 21 docs (configurable URL) - Internal cross-references: all types defined in your API link to each other
- Package name stripping: types within the same package show short names
- Three directives: full API, single class, or package summary
- Theme-compatible CSS: works with Furo, Read the Docs, Alabaster, and others
Installation
pip install sphinx-javadoc-xml
Quick Start
1. Enable in conf.py
extensions = [
"sphinx_javadoc_xml",
]
# Optional configuration
javadoc_jdk_url = "https://docs.oracle.com/en/java/javase/21/docs/api"
javadoc_load_fonts = True # Load Roboto fonts from Google Fonts CDN
javadoc_load_bulma = False # Load Bulma CSS from CDN (for non-Bulma themes)
With manticore-sphinx-theme
When using manticore-sphinx-theme, the extension automatically inherits the
Manticore color scheme (--bst-* CSS variables), Roboto fonts, and Bulma CSS
from the theme — no extra configuration needed:
html_theme = "manticore_sphinx_theme"
extensions = ["sphinx_javadoc_xml"]
# Fonts and Bulma are auto-detected and skipped (already provided by theme)
With other themes
The extension ships with the Manticore color scheme as defaults and loads Google Fonts (Roboto family) automatically. Optionally enable Bulma for enhanced table rendering:
html_theme = "furo" # or alabaster, sphinx_rtd_theme, etc.
extensions = ["sphinx_javadoc_xml"]
javadoc_load_bulma = True # Optional: pull Bulma from CDN
2. Place your XML file
docs/
├── _static/
│ └── api.xml
├── conf.py
└── api.rst
3. Use the directives
Full package API:
.. javadoc-api:: _static/api.xml
:package: net.sf.jsqlparser.expression
:public-only:
Single class:
.. javadoc-class:: _static/api.xml
:class: net.sf.jsqlparser.expression.Function
:public-only:
Package summary only (no type details):
.. javadoc-package:: _static/api.xml
:package: net.sf.jsqlparser.statement.select
:public-only:
Directives Reference
.. javadoc-api:: <path>
| Option | Description |
|---|---|
:package: |
Filter to a specific package name |
:public-only: |
Hide private and package-private members |
:jdk-url: |
Override JDK Javadoc base URL for this directive |
.. javadoc-class:: <path>
| Option | Description |
|---|---|
:class: |
Required. Qualified or simple class name |
:public-only: |
Hide private and package-private members |
:jdk-url: |
Override JDK Javadoc base URL for this directive |
.. javadoc-package:: <path>
| Option | Description |
|---|---|
:package: |
Required. Package name to render |
:public-only: |
Hide private and package-private members |
Configuration (conf.py)
| Option | Default | Description |
|---|---|---|
javadoc_jdk_url |
https://docs.oracle.com/en/java/javase/21/docs/api |
Base URL for JDK Javadoc cross-links |
javadoc_load_fonts |
True |
Load Google Fonts (Roboto family); auto-disabled under manticore-sphinx-theme |
javadoc_load_bulma |
False |
Load Bulma CSS from CDN; auto-disabled under manticore-sphinx-theme |
Cross-Linking
The extension automatically creates hyperlinks:
- JDK types → Oracle Javadoc (e.g.,
java.util.List→ docs.oracle.com/...) - Internal types → anchor links within the same page or document
- External links open in a new tab and show a small ↗ indicator
Theme Compatibility
The CSS uses CSS custom properties (--jdx-*) that automatically inherit
from manticore-sphinx-theme's --bst-* variables when available:
| Theme | Integration |
|---|---|
| manticore-sphinx-theme | Native — inherits colors, fonts, Bulma; zero config |
| Furo | Full — uses Manticore defaults, optional Bulma |
| sphinx_rtd_theme | Full — Manticore colors with RTD layout |
| Alabaster | Full — clean integration |
| sphinx_book_theme | Full — Jupyter Book style with Manticore colors |
All CSS selectors are prefixed with javadoc- so they never conflict with
theme styles.
The extension expects the XML structure produced by the xml-doclet or a compatible custom doclet. See the CHANGELOG for supported elements.
XML Format
The extension expects the XML structure produced by the xml-doclet or a compatible custom doclet. See the CHANGELOG for supported elements.
Publishing to PyPI
# Build
python -m build
# Upload to TestPyPI first
twine upload --repository testpypi dist/*
# Upload to PyPI
twine upload dist/*
Or use GitHub Actions with OIDC trusted publishing.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinx_javadoc_xml-0.3.0.tar.gz.
File metadata
- Download URL: sphinx_javadoc_xml-0.3.0.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e08c06ab625de4931761aec531e956f09b1e1715386029074ce934ebdf1c49c
|
|
| MD5 |
4dbc516f5dc196ad965c2b1b728a629d
|
|
| BLAKE2b-256 |
0ac8303189d51f77321983a7b6df53a5d77b0fa6b9144fdbf7a05e93aabb05df
|
Provenance
The following attestation bundles were made for sphinx_javadoc_xml-0.3.0.tar.gz:
Publisher:
publish.yml on manticore-projects/sphinx-javadoc-xml
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_javadoc_xml-0.3.0.tar.gz -
Subject digest:
5e08c06ab625de4931761aec531e956f09b1e1715386029074ce934ebdf1c49c - Sigstore transparency entry: 1122699518
- Sigstore integration time:
-
Permalink:
manticore-projects/sphinx-javadoc-xml@03c5032da2fde6aeb71ed9693e2f4998b2ea788e -
Branch / Tag:
refs/tags/v1.0 - Owner: https://github.com/manticore-projects
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@03c5032da2fde6aeb71ed9693e2f4998b2ea788e -
Trigger Event:
release
-
Statement type:
File details
Details for the file sphinx_javadoc_xml-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sphinx_javadoc_xml-0.3.0-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d77de75905d386374f2b496be9de48146733e50d1829754f5b64386f4323b049
|
|
| MD5 |
8d0865bc7aad1e099e0e4ef45f75c167
|
|
| BLAKE2b-256 |
dce35f243198e07d1145700109c5faf81a137cfef5d2e2be21a7e2dbe292eded
|
Provenance
The following attestation bundles were made for sphinx_javadoc_xml-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on manticore-projects/sphinx-javadoc-xml
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_javadoc_xml-0.3.0-py3-none-any.whl -
Subject digest:
d77de75905d386374f2b496be9de48146733e50d1829754f5b64386f4323b049 - Sigstore transparency entry: 1122699532
- Sigstore integration time:
-
Permalink:
manticore-projects/sphinx-javadoc-xml@03c5032da2fde6aeb71ed9693e2f4998b2ea788e -
Branch / Tag:
refs/tags/v1.0 - Owner: https://github.com/manticore-projects
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@03c5032da2fde6aeb71ed9693e2f4998b2ea788e -
Trigger Event:
release
-
Statement type: