-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Hide the navbar #872
Comments
I think currently the sidebar is always visible. I assume that based on this line: |
I worked around it by hiding and showing the icon based on the location.hash. Dirty but works: window.addEventListener('hashchange', hashHandler, false);
function hashHandler() {
if(location.hash.startsWith("#/surf/")) {
document.getElementsByClassName("sidebar-toggle-button")[0].style.display = "block";
} else {
document.getElementsByClassName("sidebar-toggle-button")[0].style.display = "none";
}
} |
did you try this |
You know none of these flags actually work? |
I didnt get you |
By default both |
Then why is there a side nav shown by default, and why doesn’t Setting It looks like |
Thanks for the details 👍 It seems like a bug here docsify/src/core/render/index.js Line 50 in db97a1d
|
There might be bugs that we should fix. We're in the process of adding unit tests, so hopefully any regressions won't happen in the future. We're not the original authors, so we're not 100% aware of any regressions, if any, but if you see anything, please do open an issue. That'd help a lot! |
Here's an idea for a workaround: you could add a CSS style that applies Another idea: you could listen to route changes, and add/remove the CSS style on route changes. |
Yep, totally understand how I can work around it, but then, if I’m going to take the time to build custom logic or CSS for and “auto”-generated site, then it isn’t very auto, is it? The goal of a tool like this seems like it should be to be fairly effortless and definitely shouldn’t require writing additional code, otherwise I could just use JSDoc out of the box and do the custom theme work myself. |
We are sorry for this issue. This project was not active for a long time and we are finding time in between to resolves these types of issues. we don't have tests to support us either. having tests would pick these kinds of bugs. If you find the fix then feel free to submit a PR to help others 👍 |
Will do. I might take a look tomorrow. |
Cool |
After looking at it.
|
We can totally do this and release a new plugin with the cause simply hiding the sidebar will fix the problem but docsify will still do all the steps of rendering, so if we are hiding it anyway, why wasting time in rendering it in first place. !!!!! Should we go for plugin or support from the core? cc @docsifyjs/core @trusktr @jthegedus @Koooooo-7 |
Check the implementation from the core. anikethsaha@9b218a1#diff-250dfe7435d59fa33e80765c47190dd5R95 |
@anikethsaha |
by default, we use I would have preferred the plugin cause this are user's preference choices and core should not be changed for every little enhancement but due to perf factors, i am leaning more towards adding it to the core. |
yep, u r right. |
Yep,,,,I see that too...you have better option? Also, I am going with implementing that in the core !! |
@Koooooo-7 do you want to take this in a better way? else I will go with my implementation !! or you want to continue as a follow-up of the anikethsaha/docsify@9b218a1 solution |
@anikethsaha I dont find a better way right now.:joy: return (
(isMobile ? `${aside}<main>` : `<main>${aside}`) +
'<section class="content">' +
'<article class="markdown-section" id="main"><!--main--></article>' +
'</section>' +
'</main>'
) I dont think it is a good way either...I haven't found when the stylings were setted yet. |
I think this approach needs either new class name or again need to do the same styling here !!! |
@anikethsaha yep, I prefer to ur implementation. |
I think this might be the part everyone is missing in this thread: If the purpose of this flag is to show/not show the sidebar why would you create another key to hide the sidebar? And if it’s set to It seems like this should be a proper It should be as simple as conditionally rendering the component like: function SideBar(props) {
return (
<>
{props.showSideBar ?
<div>
...sidebar content
</div>
: null}
</>
)
} |
Currently, when
When |
as I said |
Feature request
What problem does this feature solve?
Some sub sections of my website don't need navbar at all. I created a new project with the init command and all I have is this:
but the navbar is showing. I don't need navbar for every section of my website.
What does the proposed API look like?
I don't know. This might be a bug or I just don't know how to use the existing API
How should this be implemented in your opinion?
Not sure
Are you willing to work on this yourself?
Depends on the complexity
The text was updated successfully, but these errors were encountered: