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

Remove blank in the sidebar for headings linking to other pages #4

Closed
liulex opened this issue Nov 27, 2016 · 6 comments
Closed

Remove blank in the sidebar for headings linking to other pages #4

liulex opened this issue Nov 27, 2016 · 6 comments

Comments

@liulex
Copy link
Contributor

liulex commented Nov 27, 2016

When I use

## Getting Started

### [Snip](/Getting-Started#snip)

an unwanted blank line appears in the side bar:
snipaste20161127_160403

It corresponds to <a class="section-link" href="#snip"></a>, which I think should be removed.


Also, I am wondering if there is any way that I can hide certain headings in the content but keep them visible in the sidebar. The reason is that I have multiple pages and I would like to keep a consistent sidebar for all pages, while the content of each page stays clean and will not show the headings linking to other pages.

@liulex liulex changed the title Remove blank in the sidebar for headings linking to another page Remove blank in the sidebar for headings linking to other pages Nov 27, 2016
@QingWei-Li
Copy link
Member

It's just a toc, I do not think it can be used as navigation. Maybe you can override style.
If only less navigation, you can refer to https://qingwei-li.github.io/docsify/zh-cn#导航. You have any ideas?

@QingWei-Li
Copy link
Member

QingWei-Li commented Nov 27, 2016

Maybe we can support custom sidebar, what do you think? such as

<aside>
  <ul>
    <li>
      <a href="/Getting Started">Getting Started</a>
    </li>
    <li>
       <ul>
        <li><a href="/Getting-Started#snip">Snip</a></li>
      </ul>
   </li>
  </ul>
</aside>

Or global variables

<script>
window.Docsify.sidebar = [
  { path: '/xxx', name: 'xxx', children: [] }
]
</script>

If we do this, it will lose the toc feature.

QingWei-Li added a commit that referenced this issue Nov 27, 2016
@QingWei-Li
Copy link
Member

For now, we can custom sidebar, such as
image

<script>
  window.sidebar = [
    { slug: '/', title: 'Home' },
    {
      slug: '/pageA',
      title: 'page A',
      children: [
        { slug: '/pageA/childrenB', title: 'children B' }
      ]
    },
    { slug: '/PageC', title: 'Page C' }
  ]
</script>
<script src="/lib/docsify.js" data-sidebar="sidebar"></script>

If you approve the feature, I'll publish it in next minor version. 😄

@liulex
Copy link
Contributor Author

liulex commented Nov 27, 2016

I think the current top navbar is very good for language switching. Adding other menu items seems not suitable. However, it would be very nice it if the drop-down list feature can be added on it.

Oh, while I'm writing this, I see your updates...
Awesome! Your solution can offer me the desired navigation and also keep my .md files clean (no adding titles of other pages)! 👍

@QingWei-Li
Copy link
Member

The dropdown list can be achieved purely through CSS, maybe the users to achieve better.

QingWei-Li added a commit that referenced this issue Nov 27, 2016
* feat: custom sidebar, #4

* fix dev html

* fix doc

* fix doc
@liulex
Copy link
Contributor Author

liulex commented Nov 27, 2016

OK. I will try that. Thanks!

@liulex liulex closed this as completed Nov 27, 2016
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

2 participants