Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable live demos (renderers?) via codefences with "meta" tags #3675

Closed
4 tasks done
NullVoxPopuli opened this issue Mar 21, 2024 · 1 comment
Closed
4 tasks done

Comments

@NullVoxPopuli
Copy link

Is your feature request related to a problem? Please describe.

Vitepress offers a lot, but it doesn't allow any live demo support from the markdown.

For example, in my own experiments, I use the live tag to denote something should be rendered:

markdown code here

```jsx live
export default function App() {
  return <h1>Hello World</h1>
}
```

Closest thing I've seen is https://vitepress.dev/reference/default-theme-search#custom-content-renderer
but that would require emitting a script tag in the HTML -- which... is maybe the best we can do with SSG?

Describe the solution you'd like

have a way to hook in to code fences, with a live meta tag, and have them render.

I've done some thinking over here: NullVoxPopuli/limber#1632,
the return value could be a VueComponent, since VitePress is in Vue .. but i guess.. is there any Vue left over at run time?

maybe a script tag is the only way to move forward :think

Describe alternatives you've considered

  1. I use existing behavior with script tag
  • except, I probably need to figure out how to get a compiler and a whole mess of dependencies into the build as well hmm
  1. I write a competitor to VitePress, (wish me luck lol (and a time machine))

Additional context

thanks! vitepress is great!

Validations

@brc-dd
Copy link
Member

brc-dd commented Mar 21, 2024

Write a markdown-it plugin (add it via markdown.config) and return a vue component from it. Let me know if you need help regarding the mdit part (it'll be ~5 line code IG).

@vuejs vuejs locked and limited conversation to collaborators Mar 21, 2024
@brc-dd brc-dd converted this issue into discussion #3676 Mar 21, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants