0.3.0 • Published 2 years ago

markdown-to-config v0.3.0

Weekly downloads
18
License
ISC
Repository
github
Last release
2 years ago

markdown-as-config

A markdown to JS config object parser. Inspired by tj/mdconf

Installation

npm install markdown-to-config

Usage

import { markdownToConfig } from "markdown-to-config"

const config = markdownToConfig(markdownText, options)

Rules

  • Markdown headings act as keys
  • List items with key : value format act as maps
  • Other regular lists behave as lists
  • Any content below a heading and an empty line is stored in Symbol(CONTENT_AS_TEXT)
  • Any content can be retrieved as HTML (converted with marked library) with Symbol(CONTENT_AS_HTML)

Options

Default options:

{
    camelizeKeys: false, // replaces "long map key" by "longMapKey",
    parseContent: str => str.trim(), // function applied on content parsing
    markedOptions: null // options passed to  for html conversion
}

Demo

Try the online converter available here

0.3.0

2 years ago

0.2.1

3 years ago

0.1.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago