meteorlxy / vue-showdown

:page_with_curl: Use showdown as a vue component
https://vue-showdown.js.org
MIT License
129 stars 23 forks source link

is it possible to parse vue components in markup? #5

Closed Worie closed 5 years ago

Worie commented 5 years ago

Hi, quick question: I'm working on an app where content can be "dynamically loaded" and I wanted to allow users to use regular markup, alongside with other vue components. For example:

# some heading  
`something else`
<some-component />
blah blah blah

I don't really mind the syntax, but I just want to use vue-components between text in markup.

is it possible in vue-showdown? Or perhaps you have some hints how could I achieve something similar? Thanks!

meteorlxy commented 5 years ago

That's an interestring feature, and it's possible in vue-showdown with some modifications:

Current: https://github.com/meteorlxy/vue-showdown/blob/0f78edea5c83a3d731fcff9647530feb98db6969/src/components/vue-showdown.js#L123-L129

Modified:

  render (h) {
    return h({
      template: `<${this.tag}>${this.outputHtml}</${this.tag}>`,
    })
  },
meteorlxy commented 5 years ago

This feature is supported since v2.4.0.

See docs about vueTemplate prop