npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

handlebars-helper-mdpartial

v0.6.0

Published

Helpers for Assemble and Handlebars. {{mdpartial}} renders Markdown partials and collects YAML data and {{eachPartial}} iterates over partials.

Downloads

12

Readme

handlebars-helper-mdpartial NPM version

Helpers for Assemble and Handlebars that make working with Markdown partials easier and more flexible. {{mdpartial}} is a block helper which renders a Markdown partial and passes data to it, and {{eachPartial}} iterates over a set of partials.

Installation

Use npm to install the package in your project's directory:

$ cd your-project
$ npm install handlebars-helper-mdpartial --save-dev

Register the helper

The easiest way to register the helper with Assemble is to add the module to devDependencies and keywords in your project's package.json:

{
  "devDependencies": {
    "handlebars-helper-mdpartial": "*"
  },
  "keywords": [
    "handlebars-helper-mdpartial"
  ]
}

Alternatively, to register the helper explicitly in the Gruntfile:

grunt.initConfig({
  assemble: {
    options: {
      // the "handlebars-helper-mdpartial" npm module must also be listed in
      // devDependencies for assemble to automatically resolve the helper
      helpers: ["handlebars-helper-mdpartial", "foo/*.js"]
    },
    files: {
      "dist/": ["src/templates/*.html"]
    }
  }
});

{{mdpartial}}

Similar to {{partial}}, but this helper is used as block helper.

Inside the block you can use {{this.content}} to get the content of the partial. Also you have access to the context (in order of precedence):

  1. given context : a context explicitly passed as a second parameter, e.g. {{partial "foo" bar}}, will win over other contexts.
  2. YAML front matter : YAML front matter of the partial
  3. this : A context of this usually means either YAML front matter of the "inheriting" page or a block expression wrapping the helper
  4. Assemble options : Custom properties defined in Assemble options
  5. grunt.config.data : Data from grunt.config.data (e.g. pkg: grunt.file.readJSON("package.json"))

Note: this helper can be used for all partials, not just those ending in *.md. If the partial ends with *.md then {{this.content}} will return the content rendered as HTML.

Examples

{{#mdpartial "foo"}}
  {{this.bar}} {{this.content}}
{{/mdpartial}}
{{#mdpartial "path/to/foo.md"}}
  {{this.bar}} {{this.content}}
{{/mdpartial}}

Optionally pass in a context object as the second parameter:

{{#mdpartial "foo" contextObject}}
  {{this.bar}} {{this.content}}
{{/mdpartial}}

{{eachPartial}}

Iterates over a set of partials and adds their data to the context object. The set of partials can be filtered using blobbing patterns. It can be used inside other partials.

The context is:

  1. YAML front matter : YAML front matter of the partial
  2. { partialSrc: "[filepath]", partialName: "[name]" }
  3. Assemble options : Custom properties defined in Assemble options
  4. grunt.config.data : Data from grunt.config.data (e.g. pkg: grunt.file.readJSON("package.json"))

Examples

{{#eachPartial "**/*.md"}}
  ...
  {{partialSrc}} {{partialName}}
  ...  
{{/eachPartial}}

Combined example

{{#eachPartial "**/*.md"}}
  {{#mdpartial this}}
    
    {{this.content}}
        
    {{partialSrc}} {{partialName}}
    
  {{/mdpartial}}
{{/eachPartial}}

License

MIT License