Skip to content

Commit ca386d8

Browse files
committed
minor #18926 [Contributing] Document :ref: links (SzymonKaminski)
This PR was merged into the 5.4 branch. Discussion ---------- [Contributing] Document :ref: links PR adds an example of using `:ref:` to link to sections from other files. Commits ------- dfea1d7 [Contributing] Document :ref: links
2 parents f46d1c9 + dfea1d7 commit ca386d8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

contributing/documentation/format.rst

+22
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,28 @@ If you want to modify that title, use this alternative syntax:
190190
191191
:doc:`environments`
192192
193+
It is also possible to link to a specific section, instead of a whole page.
194+
First, define a target above section you will link to:
195+
196+
.. code-block:: rst
197+
198+
# /service_container/autowiring.rst
199+
200+
# Define the target
201+
.. _autowiring-calls:
202+
203+
Autowiring other Methods (e.g. Setters and Public Typed Properties)
204+
-------------------------------------------------------------------
205+
[section content ...]
206+
207+
Then create reference to link to that section from another file:
208+
209+
.. code-block:: rst
210+
211+
# /reference/attributes.rst
212+
213+
:ref:`Required <autowiring-calls>`
214+
193215
**Links to the API** follow a different syntax, where you must specify the type
194216
of the linked resource (``class`` or ``method``):
195217

0 commit comments

Comments
 (0)