Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sylvainpolletvillard/markdown-to-config
A markdown to JS config object parser. Inspired by tj/mdconf
https://github.com/sylvainpolletvillard/markdown-to-config
Last synced: 16 days ago
JSON representation
A markdown to JS config object parser. Inspired by tj/mdconf
- Host: GitHub
- URL: https://github.com/sylvainpolletvillard/markdown-to-config
- Owner: sylvainpolletvillard
- License: mit
- Created: 2020-05-04T16:25:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-02T16:47:43.000Z (2 months ago)
- Last Synced: 2024-10-12T00:47:01.719Z (about 1 month ago)
- Language: JavaScript
- Size: 581 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# markdown-as-config
A markdown to JS config object parser. Inspired by [tj/mdconf](https://github.com/tj/mdconf)
## Installation
```js
npm install markdown-to-config
```## Usage
```js
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:
```js
{
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](https://sylvainpolletvillard.github.io/markdown-to-config/)