A metalsmith plugin to convert a property value from markdown to HTML.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tasks
test
.editorconfig
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
Gruntfile.js
LICENSE
README.md
package.json

README.md

metalsmith-propdown Build Status npm

A metalsmith plugin to convert a property value from markdown to HTML.

Useful if you have other markdown data to convert in a file besides contents.
Requires metalsmith-collections plugin to work. This plugin uses marked to make markdown conversions.

Installation

Install it via NPM:

$ npm install metalsmith-propdown

Usage

const metalsmith = require('metalsmith');
const collections = require('metalsmith-collections');
const propdown = require('metalsmith-propdown');

metalsmith('working/dir')
  .use(collections({posts: '*.html'}))
  .use(propdown({ // make sure it comes after collections
    collection: 'posts',
    property: 'excerpt'
  }))

Will convert content of each excerpt property in posts collection files.

Options

collection

Type: String (Required)
Name of the configured metalsmith-collection to process files from (see the usage example above).

property

Type: String (Required)
Property in which value must be converted from markdown to HTML.

markdownOptions

Type: Object (Optional)
Object containing markdown options passed to marked.

Contributing

Fork this repo, install the dependecies, run the tests, submit a pull request.

$ cd metalsmith-propdown
$ npm install
$ grunt test

No grunt? No problem

You can run any grunt task just with npm scripts: npm run grunt -- <taskname>. The following command is the same as grunt test:

$ npm run grunt -- test

Automated workflow

You can keep the tests running automaticaly every time you make any change to the code with dev workflow:

$ grunt dev
$ npm run grunt -- dev

Always implement tests for whatever you're adding to the project. Thanks!

License

MIT © Almir Filho