Socket
Socket
Sign inDemoInstall

marked-async

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    marked-async

A markdown parser built for speed with async


Version published
Weekly downloads
159
increased by65.63%
Maintainers
1
Install size
369 kB
Created
Weekly downloads
 

Readme

Source

marked-async

Modified marked module for using with asynchronous renderer methods.

Install

npm install marked-async --save

marked() function return Promise object.

import marked from 'marked-async'

const html = await marked('I am using __markdown__.')
console.log(html)
// Outputs: <p>I am using <strong>markdown</strong>.</p>

async renderer

Default marked renderer is

import marked from 'marked-async'
const renderer = new marked.Renderer()

renderer.image = (href, title, text) => {
  return `<img src="${href}" />`
}

const html = async marked('# heading+', { renderer: renderer })
console.log(html)

You can also set renderer method with async mode.

renderer.image = async (href, title, text) => {

  // some async process...
  const image = await fetchImage(href)
  const size = await fetchImageSize(image)

  return `<img src="${href}" width="${size.width}" height="${size.height}" />`
}

const html = async marked('# heading+', { renderer: renderer })
console.log(html)

Author

Yusuke Shibata

Original marked is by Christopher Jeffrey.

License

MIT

Keywords

FAQs

Last updated on 11 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc