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

Develop component to show examples in multiple languages (tabs) #28

Closed
m-mohr opened this issue Jan 7, 2021 · 2 comments
Closed

Develop component to show examples in multiple languages (tabs) #28

m-mohr opened this issue Jan 7, 2021 · 2 comments
Assignees

Comments

@m-mohr
Copy link
Member

m-mohr commented Jan 7, 2021

Develop component to show examples in multiple languages (tabs)

cc @jonathom

@m-mohr m-mohr self-assigned this Jan 7, 2021
@m-mohr
Copy link
Member Author

m-mohr commented Apr 13, 2021

So there's a plugin for this, which can be used as follows in Markdown:

<CodeSwitcher :languages="{py:'Python', r:'R', js:'JavaScript'}">
<template v-slot:py>

```python
# Bye world in Python 3
print("Bye World")
```

</template>
<template v-slot:r>

```r
# Bye World in R
cat("Bye world\n")
```

</template>
<template v-slot:js>

```js
// Bye world in JavaScript
console.log("Bye World");
```

**Note:** JS is crazy!

</template>
</CodeSwitcher>

The newlines after <template> and before </template> are required for correct rendering of Markdown.

I've asked the developer whether it's possible to avoid the repetitive :languages="{py:'Python', r:'R', js:'JavaScript'}", see padarom/vuepress-plugin-code-switcher#5 - so maybe it gets a bit simpler soon. For now, just copy & paste it and we can remove it later again, if they choose to implement it.

@jonathom

@m-mohr
Copy link
Member Author

m-mohr commented Apr 13, 2021

Closing here, as there's no ToDo anymore for me. Mentioned in #16 instead so that there's a reference to the related PR.

@m-mohr m-mohr closed this as completed Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant