-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Migrate Docs to Docusaurus 2 Alpha #226
Migrate Docs to Docusaurus 2 Alpha #226
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please deploy it somewhere for easy demo.
@endiliey Live preview is available at https://redux-starter-kit.netlify.com/ |
As a first quick glance: looking at the Advanced Tutorial, the code block font seems smaller, and the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend using different theme for the codeblock. eg: vsDark because the default one is palenight and the highlighting is very dependent on theme
https://v2.docusaurus.io/docs/markdown-features#syntax-highlighting
Maybe @markerikson can choose one. Or even build own theme it needed. Theme example: https://github.com/FormidableLabs/prism-react-renderer/tree/master/src/themes
|
||
function getTrackingScript() { | ||
if (!siteConfig.gaTrackingId) { | ||
return null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no such field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw why do you need 404.js ? docusaurus handle it for you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docusaurus is returning a blank content for 404. Don't know why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why https://redux-starter-kit.netlify.com/fdsafdsf is showing a blank content?
I tried removing src/pages/404.js also. But no use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh its because redux route basepath is empty so it routes to upper level docpage. Its equivalent to https://v2.docusaurus.io/docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did adding 404.js solve the issue though ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed in next alpha release.
You can safely remove the 404.js here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding 404.js did not resolve the issue.
oh its because redux route basepath is empty so it routes to upper level docpage. Its equivalent to https://v2.docusaurus.io/docs
Sorry. I didn't get this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a react router concept. You can ignore it for now.
But just to share knowledge
// routes.js
export default [
{
path: "/docs",
component: ComponentCreator("/docs"),
routes: [
{
path: "/docs/advanced-themes",
component: ComponentCreator("/docs/advanced-themes"),
exact: true
},
{
path: "/docs/advanced-plugins",
component: ComponentCreator("/docs/advanced-plugins"),
exact: true
},
]
},
{
path: "*",
component: ComponentCreator("*")
}
];
imagine above scenario. Accessing /docs/xxxx
will match /docs/
For redux case, it;s not /docs
but /
that's why you dont have 404 even if you access /xxxx/
its rendering the parent nested route
copyright: `Copyright (c) 2015-present Dan Abramov and the Redux documentation authors.`, | ||
}, | ||
image: 'img/redux-logo-landscape.png', | ||
twitterImage: 'img/redux-logo-twitter.png', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this exist ? i dont think so
</header> | ||
<main> | ||
{features && features.length && ( | ||
<section className={[styles.features, styles.lightBackground].join(' ')}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the lightBackground
style here is breaking dark mode now
> | ||
{image && ( | ||
<div className={`text--center ${styles.blockImage}`}> | ||
<img |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we use <img src="link-to-img.svg" />
, they won't be able to pick up colors and therefore will not adapt to dark theme here neither. Probably will need to change the implementation here.
--ifm-color-primary-light: #825AC2; | ||
--ifm-color-primary-lighter: #9B7BCE; | ||
--ifm-color-primary-lightest: #B49CDA; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can add some more css here to address the styling issue raised by @markerikson
As a first quick glance: looking at the Advanced Tutorial, the code block font seems smaller, and the diff-language blocks are not getting highlighted.
The --ifm-font-size-base
defaults to 15px
from Infima, the underlying CSS framework that Docusaurus 2 uses. Where the base font size in the current RSK site is 16px
.
Although, directly changing it to 16px
causes some of the navbar item to wrap text. So you may need to tweak there a little bit.
Also the default --ifm-code-font-size
is 85%
which causes the code block to become smaller.
Meanwhile, the classes in the diff
language blocks are properly picked up, but there's no styling. This also can be fixed by adding some custom styling -- just some quick thoughts, there can be plugins / themes that already pick this up.
Edit: And yah, like @endiliey already points out, the palenight theme doesn't pick up the diff
code block, maybe we can use another theme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we're currently using Monokai as the syntax highlighting theme.
@markerikson Can we use vsDark as the syntax highlighting theme? |
@aswathkk : I'd really prefer to stick with Monokai. So where does this PR stand overall at this point? |
hey @markerikson seems there hasn't been much updates for a week, is it possible that we merge this PR to an intermediate branch at RSK then we (as Docusaurus maintainers) can work on top of that? Perhaps it is because monokai is not an available theme by prism-react-renderer that Docusaurus 2 uses, but i guess we can convert this. Looks to me we're mainly missing customized styling at this point. |
Given that there's a docs preview here, do we actually need a separate branch? |
Agree with @wgao19's approach. I think we need a separate branch so |
I think the main idea here is to let the maintainer of Docusaurus to continue @aswathkk (not a maintainer) work on the migration. Given that this PR isn't really ready yet, its not a good idea to push this to master. On another note deploy preview isn't working because the build directory has changed in v2. I recommend using a netlify config like CRA so that not only those who have access to RSK netlify.com setting can modify it. Normally you had to modify it in netlify.com But it's better to have it like this Edit: ref https://v2.docusaurus.io/docs/migrating-from-v1-to-v2#update-references-to-the-build-directory |
Okay, just created a Looks like there's conflicts from my recent changes to the tutorials. Fix those and we can merge this into the integration branch. Can that Netlify file be added on this branch, or does it need to be in |
b37cdac
to
6fe3ab0
Compare
@markerikson I've resolved the conflicts. |
It's failing to build atm, but yeah, let's go ahead and get this into the integration branch. Thanks for the work on this! |
* Migrate Docs to Docusaurus 2 Alpha (#226) * Migrate to docusaurus 2 * Change docs to MDX format * Make custom 404 compatible with Docusaurus v2 * Removes unwated stuffs as suggested by @endiliey * update doc site .gitignore for Docusaurus 2 * update dependencies for Docusaurus 2 * remove lightBackground class that breaks dark mode * inline svgs to pick up colors by dark theme * make font size align with current RSK site * use monokai css for code block * remove unused files * add netlify.toml * remove unused 404 file * move monokai into custom.css * Update docusaurus, rm -rf useless file & use correct monokai prism theme instead of css" Co-authored-by: Endi <endiliey@gmail.com> * tweak css * tweak codeblock, use line highlighting * line highlight docs * readme * tweaks * tweak monokai * larger code font * workaround for highlighting toc * bold right toc * align inline code snippet style with current rsk site - border radius should be 3px - bg color should be rgba(27, 31, 35, 0.05) * align anchor color with current rsk site - anchor color should be blue - visited color should be redux purple * align pagination pill styles with current rsk site - outline and link colors should be redux purple - hover effect flips color and bg * disable dark mode
Live Preview:


https://redux-starter-kit.netlify.com/
Here are some screenshots:
Issue
cc: @yangshun, @endiliey