{"id":14986788,"url":"https://github.com/helpers/helper-markdown","last_synced_at":"2025-04-06T18:16:58.380Z","repository":{"id":24457040,"uuid":"27859957","full_name":"helpers/helper-markdown","owner":"helpers","description":"Markdown template helper. Uses remarkable to render markdown in templates. Should work with Handlebars, Lo-Dash or any template engine that supports helper functions.","archived":false,"fork":false,"pushed_at":"2023-11-01T14:37:05.000Z","size":24,"stargazers_count":40,"open_issues_count":13,"forks_count":23,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-30T16:13:09.166Z","etag":null,"topics":["handlebars","helper","javascript","markdown","register"],"latest_commit_sha":null,"homepage":null,"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/helpers.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-11T07:45:26.000Z","updated_at":"2024-08-06T19:40:10.000Z","dependencies_parsed_at":"2024-06-18T13:41:23.360Z","dependency_job_id":"4add95dc-32d8-447b-8dab-0039a63da36e","html_url":"https://github.com/helpers/helper-markdown","commit_stats":{"total_commits":24,"total_committers":4,"mean_commits":6.0,"dds":"0.41666666666666663","last_synced_commit":"ae8a83ff7a6c16335321d3dc5a93ca0aa7296f06"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpers%2Fhelper-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpers%2Fhelper-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpers%2Fhelper-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpers%2Fhelper-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helpers","download_url":"https://codeload.github.com/helpers/helper-markdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526768,"owners_count":20953143,"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":["handlebars","helper","javascript","markdown","register"],"created_at":"2024-09-24T14:13:33.190Z","updated_at":"2025-04-06T18:16:58.356Z","avatar_url":"https://github.com/helpers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# helper-markdown [![NPM version](https://img.shields.io/npm/v/helper-markdown.svg?style=flat)](https://www.npmjs.com/package/helper-markdown) [![NPM monthly downloads](https://img.shields.io/npm/dm/helper-markdown.svg?style=flat)](https://npmjs.org/package/helper-markdown) [![NPM total downloads](https://img.shields.io/npm/dt/helper-markdown.svg?style=flat)](https://npmjs.org/package/helper-markdown) [![Linux Build Status](https://img.shields.io/travis/helpers/helper-markdown.svg?style=flat\u0026label=Travis)](https://travis-ci.org/helpers/helper-markdown)\n\n\u003e Markdown template helper. Uses remarkable to render markdown in templates. Should work with Handlebars, Lo-Dash or any template engine that supports helper functions.\n\n- [Install](#install)\n- [API](#api)\n- [Usage examples](#usage-examples)\n- [Register the helper](#register-the-helper)\n  * [templates](#templates)\n  * [assemble](#assemble)\n  * [verb](#verb)\n  * [handlebars](#handlebars)\n  * [lodash](#lodash)\n- [About](#about)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save helper-markdown\n```\n\n## API\n\n```js\nvar markdown = require('helper');\n```\n\nReturns a function that returns the helper, allowing an options object to be passed:\n\n```js\nvar hbs = require('handlebars');\nhbs.registerHelper('markdown', markdown([options]));\n```\n\n**Example**\n\nPass a custom `highlight` function for syntax highlighting to [Remarkable][], the markdown renderer:\n\n```js\nvar hljs = require('highlight.js');\nvar markdown = require('helper-markdown');\n\nfunction highlight(code, lang) {\n  try {\n    try {\n      return hljs.highlight(lang, code).value;\n    } catch (err) {\n      if (!/Unknown language/i.test(err.message)) {\n        throw err;\n      }\n      return hljs.highlightAuto(code).value;\n    }\n  } catch (err) {\n    return code;\n  }\n}\n\nhbs.registerHelper('markdown', markdown({\n  highlight: highlight  \n}));\n```\n\n## Usage examples\n\nWith Handlebars:\n\n```handlebars\n\u003cdiv\u003e\n{{#markdown}}\n# Heading\n\n\u003e this is markdown\n\nfoo bar baz\n{{/markdown}}\n\u003c/div\u003e\n```\n\nResults in:\n\n```html\n\u003ch1\u003eHeading\u003c/h1\u003e\n\u003cblockquote\u003e\n\u003cp\u003ethis is markdown\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp\u003efoo bar baz\u003c/p\u003e\n```\n\n## Register the helper\n\n\u003e This should work with any engine, here are a few examples\n\n### templates\n\nThe `templates` library supports any templates engine supported by consolidate. To register the helper with [templates](https://github.com/jonschlinkert/templates):\n\n```js\nvar templates = require('templates');\nvar app = templates();\n\napp.helper('markdown', require('helper-markdown'));\n```\n\n### assemble\n\nTo register the helper for use with [assemble](https://github.com/assemble/assemble) v0.6.0 and higher:\n\n```js\nassemble.helper('markdown', require('helper-markdown'));\n```\n\n### verb\n\nRegister the helper for use with [verb](https://github.com/verbose/verb):\n\n```js\nvar verb = require('verb');\nverb.helper('markdown', require('helper-markdown'));\n```\n\n### handlebars\n\nTo register the helper with [handlebars](http://www.handlebarsjs.com/):\n\n```js\nvar handlebars = require('handlebars');\nhandlebars.registerHelper('markdown', require('helper-markdown'));\n```\n\n### lodash\n\nTo register the helper with [Lo-Dash][] or [underscore](http://underscorejs.org):\n\n```js\nvar markdown = require('helper-markdown');\n\n// as a mixin\n_.mixin({markdown: markdown});\n_.template('\u003c%= _.markdown(\"# heading\") %\u003e', {});\n//=\u003e '\u003ch1\u003eheading\u003c/h1\u003e\\n'\n\n// passed on the context\n_.template('\u003c%= markdown(\"# heading\") %\u003e', {markdown: markdown});\n//=\u003e '\u003ch1\u003eheading\u003c/h1\u003e\\n'\n\n// as an import\nvar settings = {imports: {markdown: markdown}};\n_.template('\u003c%= markdown(\"# heading\") %\u003e', {}, settings);\n//=\u003e '\u003ch1\u003eheading\u003c/h1\u003e\\n'\n```\n\n## About\n\n### Related projects\n\n* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble \"Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit\")\n* [handlebars](https://www.npmjs.com/package/handlebars): Handlebars provides the power necessary to let you build semantic templates effectively with no frustration | [homepage](http://www.handlebarsjs.com/ \"Handlebars provides the power necessary to let you build semantic templates effectively with no frustration\")\n* [lodash](https://www.npmjs.com/package/lodash): Lodash modular utilities. | [homepage](https://lodash.com/ \"Lodash modular utilities.\")\n* [template](https://www.npmjs.com/package/template): Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… [more](https://github.com/jonschlinkert/template) | [homepage](https://github.com/jonschlinkert/template \"Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template helpers, middleware, routes, loaders, and lots more. Powers assemble, verb and other node.js apps.\")\n* [underscore](https://www.npmjs.com/package/underscore): JavaScript's functional programming helper library. | [homepage](http://underscorejs.org \"JavaScript's functional programming helper library.\")\n* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb \"Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 14 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 5 | [doowb](https://github.com/doowb) |\n| 2 | [almeidap](https://github.com/almeidap) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 08, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpers%2Fhelper-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelpers%2Fhelper-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpers%2Fhelper-markdown/lists"}