Skip to content

Allow hooks to work for Sidenav #1329

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

Open
CxRes opened this issue Aug 4, 2020 · 4 comments
Open

Allow hooks to work for Sidenav #1329

CxRes opened this issue Aug 4, 2020 · 4 comments

Comments

@CxRes
Copy link

CxRes commented Aug 4, 2020

Feature request

Allow hooks to work for Sidenav (and perhaps Navbar)

What problem does this feature solve?

I have a need where sidebar data is being generated (outside of my control) in a format different from that specified for './_sidebar.md'. With hooks enabled I can modify the sidebar information to the format Docsify wants.

What does the proposed API look like?

No changes to the API

How should this be implemented in your opinion?

Add beforeEach and AfterEach hooks to proto._renderSidebar when invoking proto.renderTo in the same pattern as proto._renderMain in 'src/render/index.js'. Though I am not sure since I cannot claim to fully understand the code.

Are you willing to work on this yourself?

Only if a maintainer will discuss proposed changes in code and verify my changes! Last thing I want to do is upload a poor PR that breaks things!!!

@trusktr
Copy link
Member

trusktr commented Aug 4, 2020

Thanks for the idea! I thought this could be helpful too. We're working in testing infra now, and we'll circle back to the good ideas after that's in place and Docsify is tested enough.

@CxRes
Copy link
Author

CxRes commented Aug 10, 2020

@trusktr Is there an ETA for when test infra would be complete?

@anikethsaha
Copy link
Member

Are you looking for something similar to #1230 #1229 ?

@trusktr
Copy link
Member

trusktr commented Aug 17, 2020

Yeah, those issues are similar. I think perhaps, to make this a non-breaking change, we can introduce these hooks for sidebar: sidebarBeforeEach, sidebarAfterEach, sidebarDoneEach. And for navbar we can add: navbarBeforeEach, navbarAfterEach, navbarDoneEach. Or similar.

@trusktr Is there an ETA for when test infra would be complete?

@jhildenbiddle made some great progress with the test infra recently. We'll be getting this merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants