add basic tab
This commit is contained in:
8
content/posts/install.md
Normal file
8
content/posts/install.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: Install
|
||||
slug: install
|
||||
---
|
||||
|
||||
<tab>
|
||||
npm install @tiptap/core @tiptap/vue
|
||||
</tab>
|
||||
@@ -19,6 +19,7 @@
|
||||
"@gridsome/source-filesystem": "^0.6.2",
|
||||
"@gridsome/transformer-json": "^0.2.1",
|
||||
"@gridsome/vue-remark": "^0.1.10",
|
||||
"@mvasilkov/outdent": "^1.0.4",
|
||||
"@noxify/gridsome-plugin-remark-embed": "^1.1.5",
|
||||
"@types/node": "^13.9.5",
|
||||
"@types/prosemirror-commands": "^1.0.1",
|
||||
|
||||
33
src/components/Tab/index.vue
Normal file
33
src/components/Tab/index.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<pre v-if="formattedCode"><code>{{ formattedCode }}</code></pre>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { outdent } from '@mvasilkov/outdent'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formattedCode: null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
updateCode() {
|
||||
const text = this.$slots.default[0].text
|
||||
|
||||
if (text) {
|
||||
this.formattedCode = outdent(text)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
beforeUpdate() {
|
||||
this.updateCode()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.updateCode()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -2,10 +2,12 @@ import Prism from 'prismjs'
|
||||
import 'prismjs/themes/prism-coy.css'
|
||||
import DefaultLayout from '~/layouts/Default.vue'
|
||||
import Demo from '~/components/Demo'
|
||||
import Tab from '~/components/Tab'
|
||||
|
||||
export default function (Vue, { router, head, isClient }) {
|
||||
Vue.component('Layout', DefaultLayout)
|
||||
Vue.component('Demo', Demo)
|
||||
Vue.component('Tab', Tab)
|
||||
Vue.filter('highlight', (code, lang = 'javascript') => {
|
||||
return Prism.highlight(code, Prism.languages[lang], lang)
|
||||
})
|
||||
|
||||
@@ -1863,6 +1863,11 @@
|
||||
call-me-maybe "^1.0.1"
|
||||
glob-to-regexp "^0.3.0"
|
||||
|
||||
"@mvasilkov/outdent@^1.0.4":
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@mvasilkov/outdent/-/outdent-1.0.4.tgz#156c7a598e08b6645272b01752fc1cff02c0f1b3"
|
||||
integrity sha512-JK4e71HtX+VG9abeTmo1ARU12G9h65CjrxFFDHfr5vgJqB31Vv6czFa9ymcZ7MMmU1h98Gkrz1IOrZNhm49g4w==
|
||||
|
||||
"@nodelib/fs.scandir@2.1.3":
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b"
|
||||
|
||||
Reference in New Issue
Block a user