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

autoHeader not compatible with plugins that write before md content #810

Open
cyrilf opened this issue Apr 6, 2019 · 1 comment
Open
Labels
bug confirmed as a bug pr welcome

Comments

@cyrilf
Copy link
Contributor

cyrilf commented Apr 6, 2019

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.

Screenshot from 2019-04-06 18-28-54
(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.

@timaschew timaschew added the bug confirmed as a bug label Apr 23, 2019
@anikethsaha
Copy link
Member

@cyrilf can you submit a fix for this.

sorry for the delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed as a bug pr welcome
Projects
None yet
Development

No branches or pull requests

3 participants