Skip to content

Commit 581f3c0

Browse files
authored
Merge pull request #86 from lucyleeow/ref_label
ENH Add reference label for rst
2 parents bf40fab + 509ed4c commit 581f3c0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/quickstart.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ html output at the same position in the page as in the source .rst file.
5353

5454
For each tag, a new rst file is created in ``<output_dir>/<tagname>.rst``
5555
containing a table of contents of each file associated with that tag (see
56-
:ref:`config`).
56+
:ref:`config`). A reference label will be added to this rst file, to enable you to
57+
cross-reference to it. The reference label will have the format: ``sphx_tag_<tagname>``
58+
e.g., a reference would look like: ``:ref:`sphx_tag_tag1```.
5759

5860
A :ref:`tagoverview` page is also created that can be added to the index and
5961
show all tags defined for this documentation set.

src/sphinx_tags/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ def create_file(
193193
content.append("#" * textwidth(header))
194194
content.append("")
195195
# Return link block at the start of the page"""
196+
content.append(f".. _sphx_tag_{self.file_basename}:")
196197
content.append(".. toctree::")
197198
content.append(" :maxdepth: 1")
198199
content.append(f" :caption: {tags_page_header}")

0 commit comments

Comments
 (0)