MkDocs Intersphinx Generator Plugin
A MkDocs plugin that generates Sphinx-compatible objects.inv files for intersphinx cross-referencing.
Features
- Page-level references via YAML frontmatter
- Header-level references via HTML comments
- Generates Sphinx-compatible
objects.invfiles
Installation
Development Installation
From the plugin directory:
pip install -e .
Or with development dependencies:
pip install -e ".[dev]"
Usage
1. Configure the Plugin
Add to your mkdocs.yml:
plugins:
- search
- intersphinx:
enabled: true
project: "My Project"
version: "latest"
2. Add References to Your Pages
Page-Level References (YAML Frontmatter)
---
ref: my-page-reference
title: My Page Title
---
# My Page
Content here...
Header-Level References (HTML Comments)
# My Page
<!-- ref:important-section -->
## Important Section
This section can be referenced by other projects.
<!-- ref:another-topic -->
### Another Topic
More content...
3. Build Your Site
mkdocs build
The plugin will generate site/objects.inv containing all references.
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
enabled |
bool | true |
Enable/disable the plugin |
project |
str | site_name | Project name for the inventory |
version |
str | "latest" |
Project version |
output |
str | "objects.inv" |
Output filename |
domain |
str | "std" |
Sphinx domain for entries |
page_role |
str | "doc" |
Role for page references |
header_role |
str | "label" |
Role for header references |
verbose |
bool | false |
Enable verbose logging |
Using Generated Inventory
From Sphinx Projects
In your Sphinx conf.py:
intersphinx_mapping = {
'myproject': ('https://example.com/docs/', None),
}
Reference in reStructuredText:
See :doc:`myproject:my-page-reference`
See :ref:`myproject:important-section`
From MkDocs with mkdocstrings
In your mkdocs.yml:
plugins:
- mkdocstrings:
handlers:
python:
import:
- https://example.com/docs/objects.inv
Development
Running Tests
pytest
Test Coverage
pytest --cov=mkdocs_intersphinx --cov-report=html
How It Works
- Parse Phase (
on_page_markdown): Extract HTML ref comments and parse headers - Collection Phase (
on_page_content): Collect inventory entries with actual anchor IDs from TOC - Generation Phase (
on_post_build): Create and writeobjects.invfile usingsphobjinv
Reference Naming Guidelines
- Use lowercase letters, numbers, hyphens, and underscores only
- Use hyphens to separate words (e.g.,
thread-safety-levels) - Make names descriptive but concise
- Ensure names are unique across your documentation
Examples
See the tests/ directory for example usage.
License
MIT
Contributing
Contributions welcome! Please open an issue or pull request.
Metadata
Release files for mkdocs-intersphinx 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkdocs_intersphinx-0.1.1.tar.gz | 11.9 kB | Without provenance | Details for mkdocs_intersphinx-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_intersphinx-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_intersphinx-0.1.1-py3-none-any.whl |
Total release size: 21.3 kB
Release files / mkdocs_intersphinx-0.1.1.tar.gz
| Download URL | mkdocs_intersphinx-0.1.1.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7af436724c9d026ae4ea7377d0bfc3e604c1abf4beee13cd91a8eb584c4faae7
|
|
BLAKE2b-256 checksum How to use checksums |
0b1aba78f1f5a98c3df82a048b5d459f0d6f993fe9feb99d592de92ffd2d10e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / mkdocs_intersphinx-0.1.1-py3-none-any.whl
| Download URL | mkdocs_intersphinx-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f29eda479a996bf0bb125b8c8a3b6205c55e0afcc41b0d8067e0e775000d5d75
|
|
BLAKE2b-256 checksum How to use checksums |
a660d83687a520a23a2e38f6f11b216c7540613aa66d0f115f72b88aea6ca4b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Security for mkdocs-intersphinx 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.