Highlighting <template> with markdown

I’m trying display a template in markdown (tried both markdown and chuangbo:marked)

but Blaze appears to try an render it as a template


<template name="mdtest">
    <template name="test">
        <p>hello world</p>

generates an error

=> Errors prevented startup:

While building the application:
client/components/markdown/test.html:5: Expected {{else}} or block close for markdown

hello world


=> Your application has errors. Waiting for file change.

any ideas how

After getting exactly the same error, I followed the example in the docs. It appears that the {{#markdown}} tag only works exactly as expected in “single-in-line” mode:

{{#markdown}}This *is* **markdown**{{/markdown}}

results in

<p>This <em>is</em> <strong>markdown</strong></p>

and renders as expected:

This is markdown


This *is* **markdown**

Results in

This *is* **markdown**

which doesn’t work as expected.

In the case of your example, the embedded <template> tag is being treated as an actual <template> tag, not a piece of literal text to be rendered in the code block. Hence the confusion - it hasn’t seen {{/markdown}} and (it thinks) a new template has arrived.

At the end of all that, I still don’t know how to solve your issue. I rolled meteor back to 1.0.2 via and got exactly the same results, so this appears to be how it’s always worked.

1 Like

thanks for looking at this Rob,

on the whole I find that markdown works on big blocks too, and with simple:highlighting can highlight code blocks

but, as we’ve both discvered, Blaze stills wants to render the <template> and any {{spacebars}}

1 Like