-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add twoslash to docs & migrate contents #481
Add twoslash to docs & migrate contents #481
Conversation
Woah this is great! Thanks a lot for kicking this off! Don't worry if we cannot convert everything 100% to twoslash, if we can merge those examples who work great it's already a great improvement! We can strip the parts that are too hard for now. Let me know if I should help! I will in any case in a few days try it out and see where we stand :) |
Hi @JonnyBurger All docs except for what is mentioned in my remark are migrated to twoslash code blocks. But two items mentioned in the help needed are migratable but I couldn't get them right. Can you check them, please? The first one is from import {Sequence} from 'remotion';
import {MyComponent} from './MyComponent';
export const Root = () => {
return (
<>
<Sequence
id="my-video"
width={1080}
height={1080}
fps={30}
component={MyComponent}
defaultProps={{
propOne: 'Hi',
propTwo: 10
}}
/>
</>
)
} TSC is complaining that The second one is from import {evaluateRootForCompositions} from 'remotion'; We can leave them not migrated if TSC is wrong but can you check and confirm, please. Thanks! |
This should be
we don't have BTW thanks for this @frencojobs, this PR is awesome. |
I just fixed the remaining snippets! Not only is it helpful for the reader, but it also ensures that we don't have typoes or unrunnable code in our documentation! I never knew we could have a type checker for our docs - now I never wanna go back! :) For me it's good enough to merge, we can have e.g. the copy button in another PR. But I'll wait for you to have the final go! |
Great! I have added exact copies of the default copy-to-clipboard buttons. I'll open this up to ready for review. Sorry for delay, timezones you know. By the way, I'm not sure about how these Issuehunt stuffs work. |
OOMs on |
Seems like trying to increase the memory only results in "rewarding for bad behavior" for this RAM eater. Since this is only because of the way docusaurus handle things (can confirm this, transforming the same files in eleventy which uses the same remark plugin only takes a portion of the time it took in docusaurus), I'll try to switch to another approach by twoslashifying markdown files beforehand feeding to docusaurus. |
This reverts commit 3df2949.
I saw it too, performance is very poor too. Let's consider opening a (proper) issue on shiki-twoslash-docusaurus, maybe we can get some help from there too! |
There is this shikijs/twoslash#35 which was closed recently because, in fact, it is not twoslash's issue. The docusaurus plugin merely exports the same remark plugin again. The remark plugin is used in all of the plugins including So I'm thinking in the meantime the PR in docusaurus upstream is in WIP (I'm not sure if it will help too), to write a script to convert all these .md files into .mdx files and stuff the converted twoslash code blocks as HTML blocks instead of letting docusaurus deal with it. So we'll turn, this # Markdown
\```ts twoslash
twoslash
\```
# Markdown
<pre> ... twoslash </pre> Then we'll use the output directory as It should be fairly quick just to turn these blocks and docusaurus will still have normal performance. |
…nto feat/docs_twoslash
That's pretty clever! Thanks for pushing it further. Let's see if it works 🤔 If the CI fails with |
@JonnyBurger Haha, sorry didn't use that technique aforementioned. I tried it for a day and gave up since mdx parser can't seem to be parsing stuffs correctly. But today I found a leak in twoslash and fixed it. It's soo much faster now than before. It is merely about the same performance as the normal docusaurus (at least on my end). Still waiting for the checks but I'm sure they'll pass. So it is mergeable now. Also, because I wanted to make sure first, I added a script called It would be nice if you could review it too. If you think it's good, you can format the files yourself, it should work fine but will probably require some manual checks as to update line highlights etc. Thanks. |
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 so great! Absolutely flashed by the PR, there are so many nice details, bugs found, done with so much care! I'm in love with this PR... 🥰
Thanks a lot for making this, and going all the way, even finding and solving a bug in shikijs - incredible work!
This PR does
Add syntax highlighting to type annotations?? (currently blocked by Twoslash)Closes #447
Help needed
/parametrized-rendering
contains two code blocks that don't compile/ssr
contains a code blocks that don't import correct APIPlayer API
's first code block didn't complete all props so can't pass the compilerRemarks
/composition
's lazy import can't be correctly typed