You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Develop component to show examples in multiple languages (tabs)
cc @jonathom
The text was updated successfully, but these errors were encountered: