npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hoedown

v0.4.1

Published

Node bindings for Hoedown, the amazing Markdown library.

Downloads

49

Readme

node-hoedown (beta)

Build Status

var hoedown = require("hoedown");

Lightweight, fast Node.JS bindings for Hoedown, the amazing Markdown library (successor for the abandoned Sundown).

Really simple to use:

var renderer = hoedown();

renderer.do("Some *useful* Markdown.") //-> "<p>Some <em>useful</em> Markdown.</p>"
renderer.do("¿ÚTF? Nö **prøblem**.") //-> "<p>¿ÚTF? Nö <strong>prøblem</strong>.</p>"
// be sure to reuse the object for blazing speed!

It's flexible

Because parsing pure Markdown is really boring, you can pass an options object to hoedown() to customize it. How about making it recognize some extensions?

var renderer = hoedown({
  extensions: hoedown.Extensions.AUTOLINK | hoedown.Extensions.FOOTNOTES
});

renderer.do("Here's a http://link.com.") //-> "<p>Here's a <a href="http://link.com">http://link.com</a>.</p>"

You can see the full list of extensions in the docs.
It's also possible to customize the HTML renderer by passing some flags:

var renderer = hoedown({
  extensions: hoedown.Extensions.AUTOLINK | hoedown.Extensions.FOOTNOTES,
  renderer: {
    flags: hoedown.HTML.Flags.HARD_WRAP | hoedown.HTML.Flags.ESCAPE
  }
});

renderer.do("Roses are red.\nViolets are blue.") //-> "<p>Roses are red.<br>Violets are blue.</p>"

The full options accepted by the HTML renderer can be found at the docs. You can also use the TOC renderer to render a Table of Contents of the document, as in this example.

Other things

Hoedown comes with a fully functional implementation of SmartyPants. You can also access Hoedown's version, use the autolinker, escape things, etc. Check out the docs and the examples!

It's secure

Hoedown is all about security. It has been extensively tested to make sure it won't crash or leak under any input. If you believe you have found a vulnerability, report it there.

That said, the HTML produced by Hoedown is not secure. Unless you're using the ESCAPE or SKIP_HTML flags, you should really consider sanitizing the HTML.

No custom renderers?

Users coming from Robotskirt may notice these bindings don't offer the possibility of including custom callbacks in renderers, or create pure JS renderers. There are many reasons for that, notably:

  • Painfully slow: the constant switches between C++ and JS decrease performance.
  • Often useless: the callbacks had to be synchronous, which totally stopped you from working with asynchronous libraries.

If you need further processing, it's better to process the rendered output (if it's HTML, you can use jsdom for instance). FIXME: mention JSON

Tip: If you need code highlighting, just include Prism in your site, it'll automatically highlight your fenced code blocks.