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

Add priority option #25

Closed
wants to merge 1 commit into from
Closed

Conversation

percevalw
Copy link

Hi,

This PR addresses the need for priority handling when a heading title appears several times throughout the site. The new priority parameter can be set to decide which page will be linked in such cases.

From the updated README:

If a heading title that appears several times throughout the site, set the priority parameter to decide which page will be linked. The priority list follows the gitignore syntax and is tested in reverse: each anchor will be assigned the lowest priority amongst all of its matches.

plugins:
  - search
  - autorefs:
    priority:
      - '*' # priority to all files
      - reference # except reference/... files 

Let me know if these changes work for you.

@pawamoy
Copy link
Member

pawamoy commented Jun 8, 2023

Hello, thanks for the PR!

Note that it is generally better to open an issue first, so we can discuss the feature request. It's more respectful of both maintainers and contributors time.

I'll try to review your PR and the issue/idea behind it as soon as possible 🙂

pawamoy added a commit that referenced this pull request Feb 27, 2024
Replaces-PR-#20: #20
Related-to-issue-#25: #25
Related-to-issue-#35: #35
Co-authored-by: Oleh Prypin <oleh@pryp.in>
Co-authored-by: tvdboom <m.524687@gmail.com>
@pawamoy pawamoy closed this in #39 Feb 27, 2024
@pawamoy
Copy link
Member

pawamoy commented Feb 27, 2024

Hey @percevalw, we just merged #39 which allows to define aliases above headings. With this feature, even if you have the same heading appearing in multiple pages, you can set a unique alias that points to it. I believe that almost entirely solves the use-case described here. The only thing that is maybe not solved is the case where the headings are generated by other plugins/extensions and you don't have control over them. In mkdocstrings case, we will be able to use these new aliases to solve this issue too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants