CyCraft/planetar

feat(code-block): toggle between JS/TS

Opened this issue · 0 comments

I want to write code snippets that are toggolable between JS and TS.

because, TS users wanna see implementation examples with Typings included
but, JS users don't want to see this

Instead of having separate TS documentation, each code snippet should be toggolable between the two.

The change is to be implemented in the CodeBlock component:
https://github.com/CyCraft/planetar/blob/production/packages/markdown/src/components/CodeBlock.vue

The syntax could be to accept an array of languages and content.

By default it will show: content[0] language[0], and then there is a toggle in the top right somewhere to switch to the second language and content.

currently the props look like this (need refactoring so they accept String | Array):
image