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
{{ message }}
Repository navigation
Vue Docs REPL implementation via SFC Playground聽#30
The most hackish part is using negative margins to move the playground's header out of the way. We could instead add a URL parameter to the playground to have it render without the header and other cruft we don't want while embedding.
Also, a simple iframe might not be what we cant in the docs as it won't be able to adjust hight-wise to the different examples
Activity
kiaking commentedon Jul 27, 2021
@LinusBorg I heard you were able to embed SFC Playground into Slidev 馃憖 Is it true? If so, can same technique applied to VitePress as well?
antfu commentedon Jul 27, 2021
I think this will do:
Ideally we could have some custom syntax to extend the markdown and transform to the iframe with corresponding hash via a simple Vite plugin. Like
LinusBorg commentedon Jul 27, 2021
Yes I did, in a crude kind of way:
https://github.com/LinusBorg/slidev-theme-vuetiful/blob/main/layouts/sfc.vue
The most hackish part is using negative margins to move the playground's header out of the way. We could instead add a URL parameter to the playground to have it render without the header and other cruft we don't want while embedding.
Also, a simple iframe might not be what we cant in the docs as it won't be able to adjust hight-wise to the different examples
kiaking commentedon Jul 27, 2021
Oh cool, seems like embedding is quite straight forward.
This is definitely great idea 馃憤
Hm. We can adjust the iframe height by css right...? So maybe import component and set height via props might work? 馃
<SFCPlayground height="320px" />LinusBorg commentedon Jul 27, 2021
Oh, btw, here's how I imported the src snippets in slidev - might be able to do this differently in vitepress:
https://github.com/LinusBorg/slidev-theme-vuetiful/blob/main/setup/main.ts