All Projects â†’ yoshuawuyts â†’ mdjson

yoshuawuyts / mdjson

Licence: MIT license
📖 Transform markdown to an object where headings are keys

Programming Languages

javascript
184084 projects - #8 most used programming language

mdjson

NPM version build status Test coverage Downloads js-standard-style

Transform markdown to an object where headings are keys.

Installation

$ npm install mdjson

Usage

const mdjson = require('mdjson')

mdjson(`
  This part (before any headers) is ignored. Feel free
  to use this section for commentary on the file's purpose,
  if you wish.

  ## my heading
  oh wow, amazing

  ## another heading
  gorgeous copy, stunning
`)
// => {
//  'my heading': {
//    raw: 'oh wow, amazing',
//    html: '<p>oh wow, amazing</p>'
//  },
//  'another heading': {
//    raw: 'gorgeous copy, stunning',
//    html: '<p>gorgeous copy, stunning</p>'
//  }
//}

Why?

Writing copy in markdown is more pleasant than writing it inline in html or JS. This module allows you to separate copy from markup on a page per page basis.

See Also

  • newspeak - Natural language localization
  • ndjson - newline delimited json parser, not to be confused with this markdown module

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].