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

New line doesn't transform in to <br> #98

Open avxkim opened 5 years ago

avxkim commented 5 years ago

New line \n doesn't transform in to <br>. It outputs as <p>

adi518 commented 4 years ago

Ran into this as well. Nasty bug. Anyone find a workaround?

Edit: Found a workaround. I configured markdown-loader with vue.config.js and injected markdown through v-html. Now it works fine. :)

samcampisi commented 3 years ago

@adi518 could you share more details about this workaround please?

FossPrime commented 3 years ago

Other workaround, use :source and es6 templates... that will preserve white space and work fine.

adi518 commented 3 years ago

@samcampisi See: https://github.com/adi518/vue-facebook-login-component/blob/master/packages/docs/vue.config.js

FossPrime commented 3 years ago

Yet another workaround...

<!-- whitespace: 'preserve' -->
<vue-markdown>
  - ichi
  - ni
  - san
</vue-markdown>
<!-- whitespace: 'condense' -->

There is probably a way to do this at a higher level