Search code examples
javascriptmeteorsummernote

Summernote outputting code instead of formatted text in the browser


I'm using mpowaga/meteor-autoform-summernote package inside meteor. I am able to insert data in database successfully however, while outputting data in the browser it shows code like this

<p><b>abstract text comes here...</b></p> 

instead of

abstract text comes here...

Article schema

@Articles = new Meteor.Collection('articles');

Schema = {}

Schemas.Articles = new SimpleSchema
    abstract:
        optional:true
        type: String
        autoform:
            afFieldInput:
                type: 'summernote'
                class: 'abstract'
                height: 200

Article Template

<table class="table table-bordered article-table">
            <tbody>
                {{#each articles}}
                    <tr>
                        <td colspan="2">
                            <h3>{{title}}</h3>
                            <p class="abstract-wrapper">
                                <p class="abstracts">
                                    {{abstract}}
                                </p>
                            </p>
                        </td>
                        <td>
                            <button type="button" class="btn btn-primary edit">Edit</button>
                        </td>
                        <td>
                            <button type="button" class="btn btn-danger delete">Delete</button>
                        </td>
                    </tr>
                {{/each}}
            </tbody>
        </table>

Solution

  • You need to use the escape syntax of spacebar templates:

    {{{abstract}}}
    

    will not render it as text, but as HTML.