assemble-markdown-data

An Assemble plugin for automatic parsing of markdown in data.

Usage no npm install needed!

<script type="module">
  import assembleMarkdownData from 'https://cdn.skypack.dev/assemble-markdown-data';
</script>

README

assemble-markdown-data

NPM version NPM dependencies

An Assemble plugin for automatic parsing of markdown in data.

Usage

First, setup a project with Grunt and Assemble.

Then install the plugin:

npm install --save-dev assemble-markdown-data

Add the plugin to your Grunt assemble config:

assemble: {
  options: {
    plugins: [ 'assemble-markdown-data' ]
  },
  // ...
},

For any data value you want to be parsed as markdown, define it as an object with markdown key whose value is a markdown string. Before rendering, this object will be replaced by the HTML that results from parsing the markdown.

Example

# profile.yml
name: Anders D. Johnson
about:
  markdown: |
    My favorite things to do are:
    * Writing code
      * Especially JavaScript
    * Browsing [GitHub](https://github.com)
age: 23

Resulting JavaScript object:

{
  "name": "Anders D. Johnson",
  "about": "<p>My favorite things to do are:</p><ul><li>Writing code<ul><li>Especially JavaScript</li></ul></li><li>Browsing <a href=\"https://github.com\">GitHub</a></li></ul>",
  "age": 23
}