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 🙏

© 2025 – Pkg Stats / Ryan Hefner

markdup

v1.0.3-beta

Published

A programmatic way to display HTML markdup

Readme

Markdup

A library for programmatically displaying html markup

Why Markdup?

Markdup was created to help display HTML markup for frontend libraries or style guides and avoid the pains of escaping HTML.

Show Me a Demo

https://wcj3.github.io/Markdup/

Usage

Simply wrap your markup in a div or section element and set the following data-attributes. Oh yeah, and make sure to have Highlight.js available.

Libraries like React or Angular may strip out certain attributes before Markdup can process

The key attributes are data-markdup-get & data-markdup-render

<section data-markdup-get="copy1">
  <div class="card">
    <div class="card-header">Featured </div>
    <div class="card-block">
      <h4 class="card-title">Card title</h4>
      <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content</p>
    </div>
  <ul class="list-group list-group-flush">
    <li class="list-group-item">Cras justo odio</li>
    <li class="list-group-item">Dapibus ac facilisis in</li>
    <li class="list-group-item">Vestibulum at eros</li>
  </ul>
  <div class="card-block">
    <a href="#" class="btn btn-primary">Button</a>
    <a href="#" class="btn btn-link">Button</a>
  </div>
  </div>
</section>
<pre class="html" data-markdup-render="copy1">
  <code></code>
</pre>

Usage in environments

// In the browser
<script>
  const mk = new Markdup(hljs);
  mk.render();
</script>

// CommonJS

import hljs from 'highlight.js';
const Markdup = require('../Markdup/lib/markdup.min');
const mk = new Markdup(hljs);
mk.render();

// ES6 imports

import Markdup from '../Markdup/tmp/markdup';
const mk = new Markdup(hljs);
mk.render();

import { Markdup } from 'markdup'

Methods

Markdup(hljs, noCustomErrors, numOfSpaces)

| Argument | Description | | --- | --- | | hljs:Object | Highlight.js object required | | nuCustomErrors:Boolean | Turns off Markdup errors and relies on browser warning | | numOfSpaces:Number | Sets number of spaces for identation. Default is 2 |