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

Added support for anchors on sidebar #349

Closed

Conversation

marcosvega91
Copy link
Contributor

Motivation

Hi, i like this project and so I have decided to improve the docusaurus functionality implementing the one suggested by @JoelMarcey.

Test Plan

I haven't completed the feature yet. It works now but I have to add support for i18n and add some styles.
I have added an option key for each category into the sidebar.json called anchors. This key is an array of anchors. The anchors are saved as metadata inside metadata.js and then they will be rendered into sidebar as an ul list inside category (image below) .

image

Related PRs

I have added the support to add anchors on sidebar throught the sidebars.json file. I have added an optional key “anchors” for each category. The anchors key must be an array of string where each string is an anchor. The next step is to make this compatible with i18n.
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Dec 22, 2017
@JoelMarcey
Copy link
Contributor

@marcosvega91 Thank you very much for this pull request. I need to get a release out with some bug fixes, but I will review this right afterwards.

Added getAnchors method that check if metadata has anchors property because it is defined only for docs and not for blogs
@marcosvega91
Copy link
Contributor Author

Hi @JoelMarcey thanks for your time. Today I have fixed a bug that caused the failing of tests. Now I would improve my code

@JoelMarcey
Copy link
Contributor

@marcosvega91 Hi! Did you want me to review this PR as it is? Or were you planning any other changes/improvements?

@marcosvega91
Copy link
Contributor Author

Hi @JoelMarcey I would like to add the support for translation for the anchors, but in these days I didn't have so much time

@microbouji
Copy link
Contributor

Hi @marcosvega91! If you're still interested in working on this we now have autogenerated anchors from the document headings. Check out #474 and #475. You can use the OnPageNav component to display the list of anchors under the currently active list item when the new siteConfig.js option onPageNav is set to 'embed'.

@JoelMarcey
Copy link
Contributor

Hi @marcosvega91 @microbouji - Just to be clear - embed doesn't currently exist - it would have to be created as the option represented by this PR in combination with what @microbouji did.

@yangshun
Copy link
Contributor

@marcosvega91 How is it going with the planned changes/improvements? Let us know how you can help! If you have less time these days to work on it, it's totally ok, just let us know and we can take it from here.

@yangshun
Copy link
Contributor

yangshun commented May 3, 2018

Closing due to inactivity. Feel free to reopen.

@yangshun yangshun closed this May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants