Skip to content

Commit

Permalink
Merge pull request #86 from lucyleeow/ref_label
Browse files Browse the repository at this point in the history
ENH Add reference label for rst
  • Loading branch information
JWCook authored Jan 2, 2024
2 parents bf40fab + 509ed4c commit 581f3c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ html output at the same position in the page as in the source .rst file.

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

A :ref:`tagoverview` page is also created that can be added to the index and
show all tags defined for this documentation set.
Expand Down
1 change: 1 addition & 0 deletions src/sphinx_tags/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def create_file(
content.append("#" * textwidth(header))
content.append("")
# Return link block at the start of the page"""
content.append(f".. _sphx_tag_{self.file_basename}:")
content.append(".. toctree::")
content.append(" :maxdepth: 1")
content.append(f" :caption: {tags_page_header}")
Expand Down

0 comments on commit 581f3c0

Please sign in to comment.