JSPM

beldown

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q12210F
  • License ISC

create dom nodes from markdown inside tagged template strings using bel & marked

Package Exports

  • beldown

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (beldown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

beldown

Create dom nodes from markdown inside tagged template strings using bel & marked.

Install

npm install --save beldown

Why

Because maybe you're working with yo-yo or choo and want a way to easily turn markdown into dom nodes they can use.

Example

var md = require('beldown')

var html = md`
  # hi

  this is markdown
`

console.log(html.toString())

This returns:

<div>
<h1 id="hi">hi</h1>
<p>this is markdown</p>
</div>

Passing options to marked

var md = require('beldown')

md.setOptions({
  gfm: false
})

var html = md`~~Github flavored markdown is off~~`
console.log(html.toString())

This returns:

<div>
<p>~~Github flavored markdown is off~~</p>
</div>

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