-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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 autoID for definition terms #13403
Comments
This reverts commit c08c8e1. This will eventually fix itself with gohugoio/hugo#13403
Questions:
In the above, it would be nice if we matched GitHub's convention --> |
Related: #11566 |
No. Or at least not now (it would certainly would require some more thinking -- and having "auto ids" will solve the problem I'm seeing now, so I will focus on that for now).
No. they share the same "auto ID context", so they will get a counter appended on conflicts.
I will have it in mind. |
I understand. The primary reason that I asked about this was the link checking that we do on the docs site, which currently verifies fragments on internal links. So we'll lose that if we convert the h6 hacks to dt's. |
@jmooring -- OK, thinking a little, this is the type Fragments struct {
// Headings holds the top level headings.
Headings Headings
// Identifiers holds all the identifiers in the ToC as a sorted slice.
// Note that collections.SortedStringSlice has both a Contains and Count method
// that can be used to identify missing and duplicate IDs.
Identifiers collections.SortedStringSlice
// HeadingsMap holds all the headings in the ToC as a map.
// Note that with duplicate IDs, the last one will win.
HeadingsMap map[string]*Heading
} I assume
|
Yes, that would work. Beginning of identifier validation in link render hook...
|
OK, then that is the new plan. |
Thank you. The link checking has been very helpful, if not indispensable . And I really hate my |
Couldn't the check be simplified to: {{- with $u.Fragment }}
{{- if gt ($p.Fragments.Identifiers.Count .) 1 }} ??? |
There are 2 checks:
code
|
Fixes gohugoio#13403 See gohugoio#11566 Co-authored-by: Joe Mooring <joe@mooring.com>
Fixes gohugoio#13403 See gohugoio#11566 Co-authored-by: Joe Mooring <joe@mooring.com>
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
We have a pretty good search setup on gohugo.io, but it's very annoying that we cannot link directly to the Definition terms.
These term listings are very convenient for documenting properties etc.
So, I will add autoID support for the terms
So,
Becomes
Markdown parser config changes:
autoHeadingID
(existing)autoDefinitionTermID
(new)autoHeadingIDType
renamed toautoIDType
(it's not possible/practical to have 2 setting for this)IDs will be added to
Page.Fragments.Identifiers
.I will make sure that
autoHeadingIDType
will still work after this.Note that the will share the same "auto ID context" as headings, so there will be no duplicate IDs.
The text was updated successfully, but these errors were encountered: