Skip to content

Commit ede1168

Browse files
Christopher MühlChristopher Mühl
authored andcommitted
Add readme
1 parent d06740b commit ede1168

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# `vuepress-plugin-code-switcher`
2+
3+
### Installation
4+
Install `vuepress-plugin-code-switcher` as a dependency and add it to your config's plugin list:
5+
6+
```js
7+
module.exports = {
8+
plugins: [ 'code-switcher' ]
9+
}
10+
```
11+
12+
### Example
13+
```markdown
14+
<CodeSwitcher :languages="{js:'JavaScript',ts:'TypeScript'}">
15+
<template v-slot:js>
16+
17+
```js
18+
module.exports = function (str) {
19+
return typeof str === 'string' && str.trim() === str
20+
}
21+
```
22+
23+
</template>
24+
<template v-slot:ts>
25+
26+
```ts
27+
export default function isString (str: string) : str is string {
28+
return typeof str === 'string' && str.trim() === str
29+
}
30+
```
31+
32+
</template>
33+
</CodeSwitcher>
34+
```
35+
36+
The extra newline between the `<template>` tags and their content is necessary if you want to have Markdown interpreted within the component.

0 commit comments

Comments
 (0)