goodpixels
goodpixels

Reputation: 523

How to render a markdown partial with Assemble?

I'm trying to render a Markdown partial using Assemble. I've setup my Grunt task as follows:

assemble: {
        options: {
            flatten: true,
            partials: [ 'src/_inc/**/*.hbs', 'src/_content/pages/*.md' ],
            layoutdir: 'src/_layouts',
            layout: 'default.hbs',              
        },
        pages: {
            options: {
                data: 'src/_data/pages/*.json',
            },
            files: {'public/': ['src/pages/*.hbs']}
        },
    }

I can easily reference any partial from that folder by simply doing {{>partial_file_name}} and it works just fine, but when I try to parse it as markdown, it won't work.

---
title: <%= home.title %>
---

<p>Source:</p>

<pre>{{>home}}</pre> <--- this works fine and returns the source code of home.md

<p>Rendered:</p>

{{md 'home'}} <--- this DOES NOT output anything!

I also tried doing {{md home}}, {{md home.md}} and {{md 'home.md'}} but none of them worked. What am I doing wrong?

Upvotes: 0

Views: 96

Answers (1)

doowb
doowb

Reputation: 3372

You can use the markdown block helper:

{{#markdown}}
  {{> home }}
{{/markdown}}

Upvotes: 1

Related Questions