Closed allejo closed 4 years ago
Just tested the hotfix and it fixed the tag issue.
I wonder if there is a need to document that specific case BTW, where the script works 2 times (adding 2 heading anchors) when called by 2 layouts used in different pages, where 1 inherits the other. The behavior looks obvious to me but IDK if there is also a way to handle some nested case like that from within the script.
Just tested the hotfix and it fixed the tag issue.
:tada:
I wonder if there is a need to document that specific case BTW, where the script works 2 times (adding 2 heading anchors) when called by 2 layouts used in different pages, where 1 inherits the other. The behavior looks obvious to me but IDK if there is also a way to handle some nested case like that from within the script.
Documenting this behavior wouldn't hurt; https://github.com/allejo/jekyll-anchor-headings/pull/14/commits/e01729ab3ac7876839e8411ce3781c6c056d9b09.
As for adding support for nesting, I think it would be limited; I could check to see if there's already an anchor in the heading and skip adding a new one if there is. I'm just curious to know if there's a use case for this behavior where this script would legitimately be used twice.
As for adding support for nesting, I think it would be limited; I could check to see if there's already an anchor in the heading and skip adding a new one if there is. I'm just curious to know if there's a use case for this behavior where this script would legitimately be used twice.
That is what happens in the sfzformat
website; one layout is the default for all pages without particular requirements, the other is for some pages that uses both default plus some specific additions (tables and some other info generated from a yml file) added on it. The double heading anchor can be seen in the 'Example' heading on one of the pages referred in the home in the test branch.
That's why I used that workaround, to use the script only once.
Does using the script only in the default layout not suffice? I thought a child layout's content would be passed up to its parent and if its parent is in charge of the anchors, then it'd work. If that's not the case, I can add the check.
You are right, it seems I was confused by the other issue and I haven't tried the obvious logic.
Sure thing! Thanks a lot for bringing this issue to my attention :+1:
My
MarkdownHTMLSnippet Usage
Expected HTML
Actual HTML
Notes
Reported by the @sfzformat team