Skip to main content

Sphinx extension for linking to VTK class documentation.

Project description

sphinx-vtk-xref is a Sphinx extension for linking directly to VTK’s documentation using the :vtk: reference role.

Installation

  1. Add sphinx-vtk-xref as a project dependency or install it with:

    pip install sphinx-vtk-xref
  2. Add sphinx_vtk_xref as an extension in your conf.py file used by Sphinx. The exact setup depends on whether your documentation is written in reStructuredText or Markdown.

reStructuredText

extensions = [
    ...,
    'sphinx_vtk_xref',
]

Markdown (MyST)

Markdown support requires MyST-Parser, which dispatches Sphinx roles like :vtk: using its own {vtk} syntax.

pip install myst-parser
extensions = [
    ...,
    'sphinx_vtk_xref',
    'myst_parser',
]
source_suffix = {
    '.md': 'markdown',
}

Usage

  • Add links to VTK class documentation with the :vtk: role. For example, write :vtk:`vtkImageData` in docstrings to link directly to the vtkImageData documentation. This will render as vtkImageData.

    If using MyST, use {vtk}`vtkImageData` instead.

  • Link directly to class members such as methods or enums. For example, write :vtk:`vtkImageData.GetSpacing` to link directly to the GetSpacing method. This will render as vtkImageData.GetSpacing.

    If using MyST, use {vtk}`vtkImageData.GetSpacing` instead.

  • Use ~ to shorten the title for the link and only show the class member after the period. For example, :vtk:`~vtkImageData.GetSpacing` will render as GetSpacing.

    If using MyST, use {vtk}`~vtkImageData.GetSpacing` instead.

  • Provide a custom title for the reference. For example, :vtk:`Get Image Spacing <vtkImageData.GetSpacing>` will render as Get Image Spacing

    If using MyST, use {vtk}`Get Image Spacing <vtkImageData.GetSpacing>` instead.

Configuration

The following options can be set in conf.py:

sphinx_vtk_xref_nitpicky

Bool, default True. Set to False to disable :vtk: link checking. This is independent of Sphinx’s own nitpicky option, so you can turn off :vtk: link validation without affecting how the rest of your project handles missing references. When disabled, the :vtk: role skips the HTTP request used to validate class and member references (and to resolve member anchors) and instead links directly to the (unvalidated) class documentation page.

sphinx_vtk_xref_nitpicky = False
sphinx_vtk_xref_ignored_status_codes

Collection of HTTP status codes, default {429, 500, 502, 503, 504}. These codes typically indicate a transient server-side issue (rate limiting or upstream unavailability) rather than a genuinely-invalid class reference, so they are logged as info messages and do not fail the build, even with Sphinx’s -W flag. The role falls back to the (unvalidated) class URL in this case.

sphinx_vtk_xref_ignored_status_codes = {404}

Notes

  • The URLs linking to the VTK documentation are checked to ensure they are valid references. A warning is emitted if the reference is invalid, but the role will still try to point to a valid URL where possible. Combine this with Sphinx’s own -W flag to fail the build on invalid links.

  • The role does not currently support linking to nested members. For example, linking to an enum member with :vtk:`vtkCommand.EventIds` works, but linking to a specific enum value with :vtk:`vtkCommand.EventIds.PickEvent` does not.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_vtk_xref-0.2.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_vtk_xref-0.2.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_vtk_xref-0.2.1.tar.gz.

File metadata

  • Download URL: sphinx_vtk_xref-0.2.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sphinx_vtk_xref-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2f7fe4fb40a360d6af161c80d9917fc19335d6545a6c7ffa16599f69e224735e
MD5 969d77d49ea0888d8ff49269d930172f
BLAKE2b-256 6de77d8075b0e1c4c21ade72fb083cca68b629febeaf4b5daddb28ba52c6a38f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_vtk_xref-0.2.1.tar.gz:

Publisher: test-and-release.yml on pyvista/sphinx-vtk-xref

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_vtk_xref-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_vtk_xref-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1cd09bde3a9ab0ba704b39a2a0e16a6d5bbe0a59043a6fa135d128cd42a77ba
MD5 5a5a5b1416a2e272e83deea5c7172a08
BLAKE2b-256 ab48382581cbd93916e343d4d268f7176f76e80cfed49c86a08a3eada026abfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_vtk_xref-0.2.1-py3-none-any.whl:

Publisher: test-and-release.yml on pyvista/sphinx-vtk-xref

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page