Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Include the ability to toggle between JavaScript and TypeScript #749

Open
ajcwebdev opened this issue Jul 16, 2021 · 3 comments
Open

Include the ability to toggle between JavaScript and TypeScript #749

ajcwebdev opened this issue Jul 16, 2021 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ajcwebdev
Copy link
Collaborator

If we look at Prisma's documentation we see that we can toggle between JavaScript and TypeScript (and even between Postgres and MySQL).

primsa-typescript-javascript-docs-toggle

The RTK docs do this for some examples as well and Mark opened an issue to Update all code blocks to toggle between TS and JS syntax.

The RTK docs currently use Lenz Weber's https://github.com/phryneas/remark-typescript-tools plugin to let us write TS syntax in code blocks, compile away the TS syntax to plain JS, and show both versions as a tab, as seen at https://redux-toolkit.js.org/api/createSlice:

The relevant RTK docs build config is at https://github.com/reduxjs/redux-toolkit/blob/818efb9c9e46df23c891feaab869d72f2d9ecc35/website/docusaurus.config.js#L12-L53 .

We might also want to look at https://shikijs.github.io/twoslash/ , which is built by one of the TS devs. Lenz has said he'd like to investigate switching the RTK docs over to that at some point, so worth considering now.

redux-typescript-javascript-docs-toggle

@dthyresson dthyresson added good first issue Good for newcomers help wanted Extra attention is needed labels Aug 7, 2021
@Mihir008
Copy link

sir can i contribute??

@thedavidprice
Copy link
Contributor

@Mihir008 contributions are very much welcome!

My concern about this Issue is that it's open ended and potentially has a massive scope. Additionally, it will include UI additions, which can also require a lot of discussion. My advice if you want to try working on something:

  • pick one specific doc on Redwoodjs.com that has a small number of code snippets (and where TS would be applicable)
  • keep the UI simple by just focusing on tabs for code blocks. See this example how Docusaurus does tabs + code blocks
  • bonus (but may be out of scope): make tab selection global on a page; e.g. if I select TS for one code block, then all code block will toggle to TS

Given all that, what do you think?

@ajcwebdev
Copy link
Collaborator Author

@Mihir008 is this still something you're interested in contributing?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants