Dair
Dair

Reputation: 16240

Getting plain text from Meteor Collection

I am working on making a blog with Meteor. I have a text box that stores the title, a textarea that stores the content of my blog entry, and a "Submit" button. When I press the button I insert a title and content field into a Meteor Collection called Entries.

In my HTML I use this template to render the blog entry:

<template name="cur_entries">
  {{#each entries}}
    <h2>{{title}}</h2>
    {{#markdown}}
{{content}}
    {{/markdown}}
    <hr>
  {{/each}}
</template>

And the Javascript for entries is:

Template.cur_entries.entries = function() {
    return Entries.find({}, {sort: {date_created: -1}});
}

It only partly works. Leaving the title textbox blank, writing this markdown example in my content textarea, and pressing "Submit" results in this:

enter image description here

As you can see the ">" is preserved, and instead of having "s, there are &quot;s. I believe when text gets posted from the Meteor Collection, it is formatted to be "correctly" rendered by HTML, instead of just plain text. Unfortunately, in this case, I don't want this convenience. Is there any way to get just plain text from a Meteor Collection?

Thanks.

Upvotes: 1

Views: 248

Answers (2)

Bozhao
Bozhao

Reputation: 181

Just a reminder, the {{#markdown}} right now is still in shark branch.

Upvotes: 0

pahan
pahan

Reputation: 2453

try using 3 curly brackets to render them as HTML.

{{#markdown}}
  {{{content}}}
{{/markdown}}

Upvotes: 3

Related Questions