Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Markdown in Meteor not rendering properly

Tags:

meteor

Given the following:

"This is the example of one paragraph.

And this is another paragraph."

If I render it in my template like this:

  <div class='post-content'>
    {{#markdown}}
      {{body}}
    {{/markdown}}
  </div>

I get the output like this

<pre><code>This is the example of one paragraph.</code></pre>

<p>And this is another paragraph.

I tried this with marked and showdown.

The only way to get rid of the pre/code is to do this:

      <div class='post-content'>
{{#markdown}}
{{body}}
{{/markdown}}
      </div>

Which is weird. How do I make the whitespace ignored for the markdown block?

like image 571
Daniel Fischer Avatar asked Feb 27 '26 17:02

Daniel Fischer


1 Answers

You are kind of contradicting yourself: whitespace has a meaning in markdown and you'd clearly like the whitespace in your body template to be interpreted correctly, so you can't ignore it.

Perhaps you like this formatting better, which should work as well. But all in all it's just an issue of pretty code formatting.

<div class='post-content'>
  {{#markdown}}{{body}}{{/markdown}}
</div>
like image 125
Christian Fritz Avatar answered Mar 02 '26 14:03

Christian Fritz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!