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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mark-deco

v1.3.0

Published

Flexible Markdown to HTML conversion library

Readme

mark-deco

Flexible Markdown to HTML conversion library.

Project Status: Active – The project has reached a stable, usable state and is being actively developed. License: MIT

What is this?

Flexible Markdown to HTML conversion library written in TypeScript. It interprets GitHub Flavored Markdown (GFM) and outputs HTML. Supports frontmatter parsing, heading analysis, source code formatting, oEmbed/card/Mermaid diagram rendering (mermaid.js or beautiful-mermaid), and custom code block processing through plugin extensions.

  • Can be used to render HTML from Markdown input.
  • Simple interface makes it very easy to use.
  • Highly independent with minimal runtime requirements. Works in both Node.js and browser environments.
  • Built-in plugins support oEmbed, cards, Mermaid.js, and Beautiful Mermaid.

Installation

npm install mark-deco

Basic Usage

Here's the simplest usage example:

import { createMarkdownProcessor, createCachedFetcher } from 'mark-deco';

// Create a memory-cached fetcher
const fetcher = createCachedFetcher('MyApp/1.0');

// Create mark-deco processor
const processor = createMarkdownProcessor({
  fetcher,
});

// Markdown to convert
const markdown = `---
title: Sample Article
author: John Doe
---

# Hello World

This is a test article.`;

// Render HTML from Markdown input
const result = await processor.process(markdown, 'id'); // ID prefix for HTML elements (described later)

// Generated HTML
console.log(result.html);
// Extracted frontmatter information (described later)
console.log(result.frontmatter);
// Extracted heading information (described later)
console.log(result.headingTree);

This will render HTML like this:

<h1 id="id-1">Hello World</h1>
<p>This is a test article.</p>

A "fetcher" is an abstraction for external server access. It's primarily used by oEmbed and card plugins for external API calls and page scraping. The argument passed to the fetcher is a user agent string, which is applied to HTTP request headers when accessing external servers.

HTML converted by the mark-deco processor is formatted in a readable manner. Advanced options allow fine-tuning of formatting conditions.

Aborting Processor Operations

While the mark-deco processor engine itself doesn't access external servers, plugins may access external servers as needed (e.g., when using oEmbed APIs or performing page scraping).

To enable operation cancellation in such cases, pass an ECMAScript standard AbortSignal instance to notify cancellation signals:

// Abort controller
const abortController = new AbortController();

// ...

// Convert Markdown to HTML
const result = await processor.process(markdown, 'id', {
  // Specify processor options
  signal: abortController.signal, // Cancellation support
});

For usage of AbortController and AbortSignal, refer to ECMAScript documentation.

CLI Interface

Although mark-deco is a library, a CLI interface is also available in the package that allows you to easily try out mark-deco. This allows you to try out conversions without having to write code in TypeScript, or call it as an independent application from another code.

# Take Markdown from standard input and output HTML
echo "# Hello World" | mark-deco-cli

Supported Features

  • Frontmatter Information Extraction - Parse YAML frontmatter from Markdown files
  • Heading ID Generation and Heading Information Extraction - Automatically generate unique IDs for headings
  • Fetcher and Cache System - External HTTP request management with configurable caching
  • Built-in Plugins - oEmbed, card, and Mermaid plugins for rich content embedding
  • Creating Custom Plugins - Develop custom plugins to extend Markdown processing
  • CLI Application - Command-line interface for batch processing

Documentation

For detailed documentation and advanced features, please visit our GitHub repository.

Note

This library was born when we determined during the development of a-terra-forge that it would be better to separate the conversion engine into a standalone component.

The project includes a demonstration page that can be run with npm run dev. Additionally, using a-terra-forge allows you to verify the implementation of a site generator utilizing mark-deco.

License

Under MIT.