{"id":18136160,"url":"https://github.com/albogdano/handlebars-helper-mdpartial","last_synced_at":"2025-04-19T14:40:42.885Z","repository":{"id":15740871,"uuid":"18479445","full_name":"albogdano/handlebars-helper-mdpartial","owner":"albogdano","description":"[DEPRECATED] Helpers for Assemble and Handlebars","archived":false,"fork":false,"pushed_at":"2020-03-15T10:42:36.000Z","size":121,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T09:51:38.277Z","etag":null,"topics":["assemle","deprecated","handlebars","handlebars-helper-mdpartial","partials"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albogdano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-06T00:07:14.000Z","updated_at":"2023-03-05T03:00:51.000Z","dependencies_parsed_at":"2022-09-17T00:41:04.666Z","dependency_job_id":null,"html_url":"https://github.com/albogdano/handlebars-helper-mdpartial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albogdano%2Fhandlebars-helper-mdpartial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albogdano%2Fhandlebars-helper-mdpartial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albogdano%2Fhandlebars-helper-mdpartial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albogdano%2Fhandlebars-helper-mdpartial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albogdano","download_url":"https://codeload.github.com/albogdano/handlebars-helper-mdpartial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249716353,"owners_count":21315066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assemle","deprecated","handlebars","handlebars-helper-mdpartial","partials"],"created_at":"2024-11-01T14:11:02.416Z","updated_at":"2025-04-19T14:40:42.854Z","avatar_url":"https://github.com/albogdano.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# handlebars-helper-mdpartial [![NPM version](https://badge.fury.io/js/handlebars-helper-mdpartial.png)](http://badge.fury.io/js/handlebars-helper-mdpartial) \n\n\u003e Helpers for [Assemble](https://github.com/assemble/assemble) and [Handlebars](http://github.com/wycats/handlebars.js) \n\u003e that make working with Markdown partials easier and more flexible.\n\u003e `{{mdpartial}}` is a block helper which renders a Markdown partial and passes data to it, and\n\u003e `{{eachPartial}}` iterates over a set of partials.\n\n\n## Installation\nUse [npm](npmjs.org) to install the package in your project's directory: \n\n```\n$ cd your-project\n$ npm install handlebars-helper-mdpartial --save-dev\n```\n\n### Register the helper\n\nThe easiest way to register the helper with [Assemble](https://github.com/assemble/assemble) is to add the module to `devDependencies` and `keywords` in your project's package.json:\n\n```\n{\n  \"devDependencies\": {\n    \"handlebars-helper-mdpartial\": \"*\"\n  },\n  \"keywords\": [\n    \"handlebars-helper-mdpartial\"\n  ]\n}\n```\n\nAlternatively, to register the helper explicitly in the Gruntfile:\n\n```\ngrunt.initConfig({\n  assemble: {\n    options: {\n      // the \"handlebars-helper-mdpartial\" npm module must also be listed in\n      // devDependencies for assemble to automatically resolve the helper\n      helpers: [\"handlebars-helper-mdpartial\", \"foo/*.js\"]\n    },\n    files: {\n      \"dist/\": [\"src/templates/*.html\"]\n    }\n  }\n});\n```\n\n## `{{mdpartial}}`\nSimilar to [`{{partial}}`](https://github.com/helpers/handlebars-helper-partial), but this helper is used as **block helper**. \n\nInside 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):\n\n1. **given context**     : a context explicitly passed as a second parameter, e.g. `{{partial \"foo\" bar}}`, will win over other contexts.\n2. **YAML front matter** : YAML front matter of the partial\n3. **this**              : A context of `this` usually means either YAML front matter of the \"inheriting\" page or a block expression wrapping the helper\n4. **Assemble options**  : Custom properties defined in Assemble options\n5. **grunt.config.data** : Data from `grunt.config.data` (e.g. `pkg: grunt.file.readJSON(\"package.json\"`))\n\n**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.\n\n### Examples\n\n```\n{{#mdpartial \"foo\"}}\n  {{this.bar}} {{this.content}}\n{{/mdpartial}}\n```\n```\n{{#mdpartial \"path/to/foo.md\"}}\n  {{this.bar}} {{this.content}}\n{{/mdpartial}}\n```\nOptionally pass in a context object as the second parameter:\n\n```\n{{#mdpartial \"foo\" contextObject}}\n  {{this.bar}} {{this.content}}\n{{/mdpartial}}\n```\n\n## `{{eachPartial}}`\n\nIterates over a set of partials and adds their data to the context object.\nThe set of partials can be filtered using blobbing patterns. \nIt can be used inside other partials. \n\nThe context is:\n\n1. **YAML front matter** : YAML front matter of the partial\n2. `{ partialSrc: \"[filepath]\", partialName: \"[name]\" }`\n3. **Assemble options**  : Custom properties defined in Assemble options\n4. **grunt.config.data** : Data from `grunt.config.data` (e.g. `pkg: grunt.file.readJSON(\"package.json\"`))\n\n### Examples\n\n```\n{{#eachPartial \"**/*.md\"}}\n  ...\n  {{partialSrc}} {{partialName}}\n  ...  \n{{/eachPartial}}\n```\n\n## Combined example\n\n```\n{{#eachPartial \"**/*.md\"}}\n  {{#mdpartial this}}\n    \n    {{this.content}}\n        \n    {{partialSrc}} {{partialName}}\n    \n  {{/mdpartial}}\n{{/eachPartial}}\n```\n\n## License\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbogdano%2Fhandlebars-helper-mdpartial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbogdano%2Fhandlebars-helper-mdpartial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbogdano%2Fhandlebars-helper-mdpartial/lists"}