Skip to content

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

@mesqueeb

Description

@mesqueeb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions