Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sethvincent/beldown
create dom nodes from markdown inside tagged template strings using bel & marked
https://github.com/sethvincent/beldown
Last synced: about 1 month ago
JSON representation
create dom nodes from markdown inside tagged template strings using bel & marked
- Host: GitHub
- URL: https://github.com/sethvincent/beldown
- Owner: sethvincent
- License: isc
- Created: 2016-09-15T23:59:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-21T00:22:10.000Z (over 8 years ago)
- Last Synced: 2025-01-08T10:07:48.050Z (about 1 month ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 18
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# beldown
Create dom nodes from markdown inside tagged template strings using [bel](https://github.com/shama/bel) & [marked](https://github.com/chjj/marked).
## Install
```
npm install --save beldown
```## Why
Because maybe you're working with [yo-yo](https://github.com/maxogden/yo-yo) or [choo](https://github.com/yoshuawuyts/choo) and want a way to easily turn markdown into dom nodes they can use.
## Example
```js
var md = require('beldown')var html = md`
# hithis is markdown
`console.log(html.toString())
```This returns:
```html
hi
this is markdown
```## Passing options to [marked](https://github.com/chjj/marked)
```js
var md = require('beldown')md.setOptions({
gfm: false
})var html = md`~~Github flavored markdown is off~~`
console.log(html.toString())
```This returns:
```html
~~Github flavored markdown is off~~
```## Caveats:
The wrapping div is required because multiple root elements must be wrapped in an enclosing tag. I'm not sure if there's a great way around that.Leading whitespace of each line is currently stripped. Maybe there's a case where that breaks things?
## License
[ISC](LICENSE.md)