Skip to content

Linking to internal pages and API reference in Sphinx

Lars Hinüber edited this page Feb 17, 2025 · 2 revisions

The following gives an overview of how you can link to various targets in Sphinx.

Links inside tudat-space

Link to label inside tudat-space:

:ref:`getting_started_quickstart`

where the label is defined as

.. _getting_started_quickstart:

will be rendered as Quickstart: Tudat(Py) in 10 minutes

Link to file inside tudat-space:

:ref:`/_src_getting_started/quickstart.rst`

will be rendered as Quickstart: Tudat(Py) in 10 minutes

This is not preferred, as the file path may change. However, if you want to link to a file, use absolute paths (relative to the conf.py file, with a prepended / such that the link does not break if you move the file where the link is placed).

Custom link text:

:ref:`Slowstart in 30 minutes <getting_started_quickstart>`

will be rendered as Slowstart in 30 minutes.

Links to API reference

For all module-level references, use the :doc: directive:

Link to top level API documentation

:doc:`index` 

will be rendered as API Reference.

Link to module

:doc:`astro`

will be rendered as astro.

Link to submodule

:doc:`element_conversion`

will be rendered as element_conversion

Link to class

:class:`tudatpy.numerical_simulation.propagation_setup.propagator.TranslationalStatePropagatorSettings`

will be rendered as tudatpy.numerical_simulation.propagation_setup.propagator.TranslationalStatePropagatorSettings.

Shortening links

Links can be shortened to last part of the link by using the ~ symbol:

:class:`~tudatpy.numerical_simulation.propagation_setup.propagator.TranslationalStatePropagatorSettings`

will be rendered as TranslationalStatePropagatorSettings.

Link to attribute

:attr:`~tudatpy.numerical_simulation.propagation_setup.propagator.TranslationalStatePropagatorSettings.acceleration_settings`

will be rendered as acceleration_settings.

Link to property

:attr:`~tudatpy.numerical_simulation.propagation_setup.propagator.MultiTypePropagatorSettings.propagator_settings_per_type`

will be rendered as propagator_settings_per_type.

Link to method

:meth:`~tudatpy.numerical_simulation.propagation_setup.propagator.TranslationalStatePropagatorSettings.get_propagated_state_size()`

will be rendered as get_propagated_state_size()

Link to function

:func:`~tudatpy.numerical_simulation.propagation_setup.propagator.translational()`

will be rendered as translational()

Link to enumeration

:class:`~tudatpy.numerical_simulation.propagation_setup.propagator.TranslationalPropagatorType`

will be rendered as TranslationalPropagatorType