miaolz123 / vue-markdown

A Powerful and Highspeed Markdown Parser for Vue
https://miaolz123.github.io/vue-markdown/
MIT License
1.89k stars 257 forks source link

Change the source from methods highlight doesn't work #72

Open klinux opened 6 years ago

klinux commented 6 years ago

If I create a data bind with code like:

data () {
   return {
      md: '```javascript\n if(1 === 1) {\n return true;\n }\n```'
  }
}

And in template I make

<vue-markdown :source="md"></vue-markdown>

This works like a charm.

But if I use a external content for my markdown, and use a method to load the data bind, this not work.

data () {
   return {
      md: null
  }
},
methods: {
   getContent(content) {
     ....
     this.md = content.body
   }
}

The highlight doesn't work.

Someone has any idea about that?

Thank you.

leopoldchen commented 5 years ago

Seems like the highlight feature was removed (https://github.com/miaolz123/vue-markdown/commit/3ec711e0eae9828b53ca08e241647bc460eefc7b)

But you can use Prismjs instead, see the examples.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/themes/prism.min.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/prism.min.js"></script>