miaolz123 / vue-markdown

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

Putting a class on a markdown heading #31

Closed kaydwithers closed 7 years ago

kaydwithers commented 7 years ago

I'm building a site with Contentful and I'm trying to put a class on a heading.

My code looks like the below

<vue-markdown class="f3">
  ### {{ hello.fields.heading }}
</vue-markdown>

And renders out to

<div class="f3">
  <h3>Hello</h3>
</div>

What I would really like to render out is

<h3 class="f3">
  Hello
</h3>

Is putting a class on a markdown heading possible? Sorry if this has been covered already.

miaolz123 commented 7 years ago

Is looks like is impossible to achieve, but you can write HTML in markdown string like this:

<h3 class="f3">Hello</h3>

I'm very sorry because this is not a good idea.