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

fix(v2): throw error if first level item of a sidebar is not category #1994

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

endiliey
Copy link
Contributor

Motivation

Close #1993

See that issue for more context

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

  • Newly added test passes

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 14, 2019
@endiliey endiliey added pr: bug fix This PR fixes a bug in a past release. pr: polish This PR adds a very minor behavior improvement that users will enjoy. labels Nov 14, 2019
@yangshun
Copy link
Contributor

How about we allow non-categories for first-level items? Seems like a valid thing to do.

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 0fa178f

https://deploy-preview-1994--docusaurus-2.netlify.com

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-preview ready!

Built with commit 0fa178f

https://deploy-preview-1994--docusaurus-preview.netlify.com

@endiliey
Copy link
Contributor Author

endiliey commented Nov 14, 2019

Hmm i don't know, maybe in the future. But honestly at this point i won't work on it for now until i finish versioning. That will require some quite refactoring on docs plugin (which will definitely conflict with my versioning PR #1983 and fixing conflict on my own is kinda sad. we'll have to update our documentation as well https://v2.docusaurus.io/docs/sidebar/#sidebar-object

This is only possible in v2 though, because v1 use object keys for the category :|
I am pretty sure most people are doing

// sidebars.js
module.exports = {
  docs: {
    'Getting started': ['greeting'],
    Docusaurus: ['doc1'],
  },
};

Especially for v1 users

@endiliey
Copy link
Contributor Author

endiliey commented Nov 14, 2019

I'm gonna merge it first since that seems more like a feature request. If someone wanted to work on that, send a PR (don't forget tests). PS: it will need quite some refactor on order.ts, sidebars.ts and index.ts on docs plugin.!All typings must be updated as well since assumption is different now

@endiliey endiliey merged commit 4e5a03f into master Nov 14, 2019
@endiliey endiliey deleted the endi/category branch November 14, 2019 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release. pr: polish This PR adds a very minor behavior improvement that users will enjoy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot link directly to doc in sidebar
5 participants