fix: add name attribute to header permalink
#26
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Dependant of: https://github.com/ArkEcosystem/ark.dev/pull/191
The old version of the
thephpleague/commonmarklibrary used to add anameattribute to the header permalinks (the links inside the#) since that name matches the link the internal links worked properly. (See anchor links on https://ark.dev/docs/glossary/glossary)The current version, however, doesn't add that attribute meaning the links doest work. (See anchor links on ark.dev PR glossary section)
That name is necessary to make the anchor link works since the id have a
user-content-prefix that doesn't match the linkThis PR replaces the renderer for a new one that is exactly the same but adds the name attribute.
Note:
The current alternative on this PR replicates the exact old behavior, a simple alternative is to remove the prefix on the IDs, which also works (at least on the glossary section), the problem is that I cannot say for sure that all the links point to the id and also the id can potentially interfere with other ids in the site, for example, if we have a header with User as title and a form with an input#user both will have the same ID, I don't think is very likely to happen but not impossible so I think it worth a discussion.
Permalinks Before:
Permalinks After:
Checklist
icons.htmlfile and checked if my newly added icon is shown correctly (if necessary)