Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags for header/anchors, instead of per page? #47

Open
melissawm opened this issue Feb 7, 2023 · 1 comment
Open

Tags for header/anchors, instead of per page? #47

melissawm opened this issue Feb 7, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@melissawm
Copy link
Owner

Would it be possible to have tags associated with section headers or anchors instead of per page?

@melissawm melissawm added enhancement New feature or request help wanted Extra attention is needed labels Feb 7, 2023
@JWCook
Copy link
Collaborator

JWCook commented Jul 19, 2023

Here are a few ideas:

Option 1: section header anchors

From the limited context that a directive has access to, it might be difficult to automatically find the nearest section header. Possibly by manually parsing the document starting at SphinxDirective.lineno? Or is there other info available in SphinxDirective.state that could be used here?

Option 2: user-specified anchor

Alternatively, the directive could be updated with an option to create a new anchor, with usage like:

```{tags} tag_1, tag_2
:ref: my-custom-anchor
```

And then:

  • Update TagLinks to insert a ref node directly before the tag list
    • Would there be a way to first check if the ref already exists elsewhere?
  • Update links on tag index and tag pages to point to site.com/_tags/page.html#my-custom-anchor.

Option 3: automatic anchor

Or, instead of adding a directive option, TagLinks could automatically add a unique ref to each instance (like {document_name}-tags). Maybe that could be enabled/disabled with an extension config option.

@melissawm melissawm added this to the 0.3.1 milestone Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants