You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
autoHeader looks for the first node in #main and if it's an h1 then it does nothing, if not it will create the auto header.
Fine.
The issue arises when using any plugin writing content before the user defined markdown.
A plugin like "Edit this Page" link plugin for instance.
autoHeader doesn't detect my H1 (because the edit link is first) and create an header.
The line responsible is here.
(in this screenshot Introduction shouldn't be here as My super title is defined.)
A solution could be that instead of looking if the 1st element is an H1 we could do instead something like: dom.getElementsByTagName('h1').length and trigger our autoHeader if it's equal to 0.
Otherwise we need to find a better way of making the distinction between user content and content added via plugins. But I'm not familiar enough with docsify codebase to find out at the moment.
If you think this my first solution is acceptable, then I could open a PR.
The text was updated successfully, but these errors were encountered:
autoHeader
looks for the first node in#main
and if it's anh1
then it does nothing, if not it will create the auto header.Fine.
The issue arises when using any plugin writing content before the user defined markdown.
A plugin like "Edit this Page" link plugin for instance.
autoHeader
doesn't detect myH1
(because the edit link is first) and create an header.The line responsible is here.
(in this screenshot
Introduction
shouldn't be here asMy super title
is defined.)A solution could be that instead of looking if the 1st element is an H1 we could do instead something like:
dom.getElementsByTagName('h1').length
and trigger ourautoHeader
if it's equal to0
.Otherwise we need to find a better way of making the distinction between user content and content added via plugins. But I'm not familiar enough with
docsify
codebase to find out at the moment.If you think this my first solution is acceptable, then I could open a PR.
The text was updated successfully, but these errors were encountered: