File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 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.
You can’t perform that action at this time.
0 commit comments