Skip to content

Bulk transform markdown frontmatter

License

Notifications You must be signed in to change notification settings

zentered/frontformatter

Repository files navigation

Test Semantic Release view on npm

Front Formatter

If you work with hugo, 11ty or any other static site generator, you'll likely end up with a lot of Markdown files after a while.

This script helps to migrate, add or remove properties from Markdwon frontmatter.

Usage

Specify a source folder or copy your markdown files into src. You can define properties to add and remove, then run the transformation function:

const frontformatter = require('./frontformatter')

const addProperties = {
  add: 'this'
}
const removeProperties = ['remove']

const markdownOptions = {
  resultVersion: 3,
  'first-line-heading': 2,
  'no-empty-links': true
}

frontformatter('src', addProperties, removeProperties, markdownOptions)

Acknowledgments

Thanks to Jon Schlinkert for gray-matter

Licence

Licensed under MIT.