remark-hbs

Remark plugin that allows writing markdown with Ember handlebars templates

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
35Jun 14, 2021Mar 24, 2020Minified + gzip package size for remark-hbs in KB

Readme

remark-hbs

Remark plugin that allows writing markdown with Ember handlebars templates.

Install

yarn add remark-hbs

Usage

Say we have the following markdown file, example.md:

# Lorem ipsum

<MyComponent @myArg={{this.isTesting}}>
  This is my component
</MyComponent>

And our script, example.js, looks as follows:

const fs = require('fs')
const unified = require('unified')
const markdown = require('remark-parse')
const hbs = require('remark-hbs')
const html = require('remark-html')

const template = unified()
  .use(markdown)
  .use(hbs)
  .use(html)
  .processSync(fs.readFileSync('example.md'))
  .toString()

console.log(template)

Now, running node example.js yields:

<h1>Lorem ipsum</h1>
<MyComponent @myArg={{this.isTesting}}>
  This is my component

</MyComponent>

Limitations

  • Closing an element tag in a new line is not supported as it is parsed as blockquote in markdown. For example at line 3:
    <Something
    class="something"
    >
    </Something>
    

License

This project is licensed under the MIT License

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.