diff --git a/components/OneDemo.vue b/components/OneDemo.vue
index 465e89b..477c8a8 100644
--- a/components/OneDemo.vue
+++ b/components/OneDemo.vue
@@ -49,6 +49,11 @@
:name="localExpanded ? 'one-demo-code-off' : 'one-demo-code'"
/>
+
diff --git a/components/OneEditLink.vue b/components/OneEditLink.vue
index f01fa55..18f9e3a 100644
--- a/components/OneEditLink.vue
+++ b/components/OneEditLink.vue
@@ -1,15 +1,24 @@
- {{ t('editOnGitHub') }}
-
+
+ {{ t("editOnGitHub") }}
+
+
@@ -27,6 +36,10 @@ export default {
},
mixins: [i18n],
props: {
+ variant: {
+ type: String,
+ default: 'default'
+ },
path: String
},
computed: {
@@ -39,27 +52,39 @@ export default {
diff --git a/one/build/rehype-demo.js b/one/build/rehype-demo.js
index 453d8d0..cca03a6 100644
--- a/one/build/rehype-demo.js
+++ b/one/build/rehype-demo.js
@@ -8,14 +8,15 @@ export default function attacher () {
let { tagName } = node
let [name] = tagName.match(RE_DEMO) || []
if (name) {
- let { code, desc, browser } = data.demos[name] || {}
+ let { code, desc, browser, path } = data.demos[name] || {}
if (!code) {
return
}
let demo = h('one-demo',
{
- browser
+ browser,
+ path
},
[
node,
diff --git a/one/build/remark-demo.js b/one/build/remark-demo.js
index 3bfcf1d..791c5d5 100644
--- a/one/build/remark-demo.js
+++ b/one/build/remark-demo.js
@@ -40,6 +40,8 @@ export default function attacher () {
? resolve(DOCS_DIR, src.slice(1))
: resolve(dirname(path), src)
+ let demoRelativePath = relative(DOCS_DIR, demoPath)
+
if (!existsSync(demoPath)) {
console.warn(`Demo not found at '${demoPath}'`)
return
@@ -55,7 +57,8 @@ export default function attacher () {
let { content, doc } = extractDoc(demoPath, { locale })
fileData.demos[name] = {
- path: demoPath,
+ filePath: demoPath,
+ path: demoRelativePath,
browser,
code: render('```vue\n' + content + '\n```', demoPath).contents,
desc: render(doc, demoPath).contents