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

Support sidebars with links to anchors in the same page #344

Closed
JoelMarcey opened this issue Dec 21, 2017 · 6 comments
Closed

Support sidebars with links to anchors in the same page #344

JoelMarcey opened this issue Dec 21, 2017 · 6 comments
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: claimed Issue has been claimed by a contributor who plans to work on it.

Comments

@JoelMarcey
Copy link
Contributor

Is this a bug report?

No. Feature request

Have you read the [Contributing Guidelines]

Why, yes, I have :)

Environment

N/A

Steps to Reproduce

N/A

Expected Behavior

Have a sidebar with links that don't go to different pages, but rather goes to anchors within the same page.

Actual Behavior

N/A

Reproducible Demo

N/A

@JoelMarcey JoelMarcey added the feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. label Dec 21, 2017
@neilsutcliffe
Copy link
Contributor

I would suggest this be auto generated from the markdown content.

Something like the following

## [Favourite Dinosaurs](#)

* T-Rex
* Raptor

And display an icon like ⚓ next to any of these.

@microbouji
Copy link
Contributor

I can work on enabling this as a config option as discussed in babel/website#1582

Live demo of proposed UI: https://deploy-preview-1582--babel-new.netlify.com/docs/en/index.html

With the new option set to on, the html for the on page navigation will be generated from h2s and h3s in the markdown, and on big screens the main sidebar will switch to fixed position and the new sidebar will show up as well.

I'm thinking of making this a progressive enhancement only in browsers that @support the css "position: sticky" property instead of using polyfills.

@JoelMarcey
Copy link
Contributor Author

Hi @microbouji. Thanks! We have PR #349 that I would love for you to take a look at to see if it meets your standard for this feature. If so, we could use that (or make minor improvements). If not, would love to see what you come up with.

@microbouji
Copy link
Contributor

Hi @JoelMarcey! That's a nice alternative and should probably be the default as it doesn't change the layout from fixed to full width. The separate sidebar that I proposed above could then be enabled with an option for folks who have long doc pages with many subheaders. Option could look like this:

anchorsNav: false (what we have now) | "inline" (PR #349) | "separate" (my solution)

I should have a PR tomorrow and we can iterate there more. Even if you don't end up needing the separate sidebar, the function to generate links from the headers can be reused even in the other PR.

@JoelMarcey
Copy link
Contributor Author

@microbouji By the way, I am loving the new Babel site. You all have done really good work.

@JoelMarcey JoelMarcey added difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. status: claimed Issue has been claimed by a contributor who plans to work on it. labels Feb 28, 2018
@yangshun
Copy link
Contributor

yangshun commented May 4, 2018

I believe this feature is live after #524. @microbouji correct me if I'm wrong 😄

@yangshun yangshun closed this as completed May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: claimed Issue has been claimed by a contributor who plans to work on it.
Projects
None yet
Development

No branches or pull requests

4 participants