Mysterious Markdown Behaviour

Hey guys,

I am experiencing something that goes way beyond my wisdom… for some reason, Meteor is rendering the first line of my Markdown as a code block. Everything until the first line break is considered code, regardless of what it is. I checked the text to see if there are any symbols causing this, but everything seems to be correct… I am using the good old markdown package from Meteor itself.

Any ideas?

Here is my code:

text.html

<div class="row first-row readRow">
        <div class="col-12">
            <div id="pageText">
                {{#markdown}}
                {{textToShow}}
                {{/markdown}}
            </div>
        </div> <!-- end col-->
</div>

text.js

//this is the only relevant part

Template.TextRead.helpers({
    'textToShow'(){
        let text = 'Hello my friends';
        return text;
    }
});

result

What happens if you remove the {{#/markdown}} tags in text.html - does it still render as <code>?

Have you checked the DOM in the web inspector?

Hey,

Thanks for the reply.

When removing the {{#/markdown}} tags it renders correctly as text.

When checking the DOM (with {{#/markdown}}), I discovered that for some reason a < code > tag is added at the beginning with class “hljs python” (from highlight.js).

Note: I am using the simple:highlight.js package

SOLVED!

For anyone having this issue in the future:

Put your content helper and the markdown indicators in the same line.

DO THIS
{{#markdown}} {{myMarkdownText}}{{/markdown}}

NOT THIS
{{#markdown}}
{{myMarkdownText}}
{{/markdown}}

1 Like