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

Add TypeScript types to documentation using TwoSlash #688

Open
jsudelko opened this issue Jun 30, 2024 · 4 comments
Open

Add TypeScript types to documentation using TwoSlash #688

jsudelko opened this issue Jun 30, 2024 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@jsudelko
Copy link

jsudelko commented Jun 30, 2024

TwoSlash allows you to add types to your code block markup. For a TypeScript-focused library it would be a godsend. Sometimes I have to switch back and forth between VS Code and docs copying over documentation examples in order to understand what something means or the expected type output. It would he handy if I could simply hover to see the actual TypeScript types.

See Rollup as an example of TwoSlash in the wild. Hover over the JavaScript code snippet.

@fabian-hiller
Copy link
Owner

Thank you for sharing. Feel free to create a PR and implement it.

@fabian-hiller fabian-hiller self-assigned this Jun 30, 2024
@fabian-hiller fabian-hiller added the documentation Improvements or additions to documentation label Jun 30, 2024
@ZerNico
Copy link
Contributor

ZerNico commented Aug 27, 2024

I started trying to implement this btw.
I changed the Syntax highlighter to Shiki and implemented TwoSlash with it which mostly works.
The problem is, that the default renderer of TwoSlash renders <pre> Elements inside each other for the popups which is an invalid nesting in the HTML spec and the QwikCity dev server just blocks that outright and displays an error.
We'd probably have to implement a custom renderer for it, maybe even with some library for nicer popups.
For example the VitePress TwoSlash plugin uses https://floating-vue.starpad.dev/.
Do you know of a good existing library for Qwik that would work for that?

@fabian-hiller
Copy link
Owner

Thank you for your contribution! Maybe QwikUI? Or we just build it ourselves like I did with all the other components. But to be honest, I do not have the time to focus on this right now as our v1 RC release has a much higher priority at the moment.

@ZerNico
Copy link
Contributor

ZerNico commented Aug 27, 2024

Ah I will check that out, thank you! A custom component would probably also not be that hard to implement.
No worries, this has no priority at all, it would just be a nice small addition to the docs. I will work on it from time to time when I have the time, maybe we can eventually add it to the docs some day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants