Closed luooooob closed 1 year ago
Will the pr generate a preview here? that would be a bit awesome. The build command should not change. You may need to upgrade the node version of the deployment environment.
The netlify/tokio/deploy-preview
CI step should provide a preview.
I found it possible to render Markdown at build time, and now the client is much lighter
There is still a lot of work to be done to make the client lighter and simplify the code, I can still work on it if this update is approved
-----update----
The auto-generated preview looks like it doesn't update the cache, here's the new preview link
Put the markdown rendering logic on the node side, and also found some other optimizations that now reduce the first screen rendering size of every tutorial and blog page by 65% or even 75%
The last few versions of Next.js have made a lot of progress, so I tried to upgrade version 9.4 to 13, React, Typescript and markdown related libraries were also upgraded together because these versions are really old, the main work is as follows
the new version of Next has requirements for extra
js
andcss
files, and the way to write<Link />
has also changed, just follow the upgrade guide to do thispackage lock.json has been upgraded to the latest algorithm, so the number of commit lines seems a bit high. I highly recommend switching to pnpm, it's really much faster than npm.
react-markdown
has been upgraded a lot, the direct insertHTML
function has been removed, so you need to introduce the newrehype-raw
plugin. slug function also has a very good pluginrehype-slug
can be used, no need to maintain some bad code yourselfthe only breaking change that needs your attention is that the old warning and info directive syntax is not compatible with the new version of the renderer, the syntax is too specific and there is no way to find a replacement.
I found that Github is experimenting with a new syntax based on blockquote, and it's easy to implement, so I changed it to this implementation
The rendered result is still exactly the same as the old one, but you need to pay attention to writing new documents later. The old document has been replaced by a global search
Next now supports esm syntax, so you don't need to stuff generate-rss-feed.js into webpack to make a package, just
node ./script/generate-rss-feed.js
will work, I've tried it and it works.almost all places look exactly the same as the old one, just optimized code.I saw a PR for migrating to docusaurus, you don't seem to like it, but this project with too many outdated dependencies is really annoying, I hope my work can help you