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

@thamidu-nadun/md_parser

v1.0.4

Published

Parse markdown content to html with custom plugins. Ideal for tech blog. Everything right out-of-the-box.

Readme

📝 @thamidu-nadun/md_parser

NPM version License: MIT

A powerful, flexible, and feature-rich Markdown parser designed to bring your text to life! 🚀 Easily convert Markdown to HTML with support for front-matter, emojis, task lists, KaTeX math expressions, and beautiful custom callouts. Perfect for blogs, documentation sites, and any project that needs a little extra sparkle. ✨

🌟 Key Features

  • 📝 Front Matter: Extracts YAML metadata right from the top of your files.
  • 😄 Emojis: Full emoji support (:tada: becomes 🎉).
  • 🦶 Footnotes: Adds clean and simple footnotes.
  • ✅ Task Lists: Renders GitHub-style task lists.
  • 🧮 KaTeX: Supports elegant mathematical typesetting.
  • 🎨 Custom Callouts: Includes 5 stylish, attention-grabbing callout boxes (Tip, Note, Warning, Info, Error).
  • 🔌 Extensible: Easily inject your own markdown-it plugins to add new functionality.

📚 Full Documentation

[!TIP] For a deep dive into every feature, including basic Markdown syntax and advanced customization, please check out our full documentation in the docs folder.

📦 Installation

Get started in seconds by installing the package from npm.

npm i @thamidu-nadun/md_parser

📖 Basic Usage

Using the parser is straightforward. Import the renderer function, pass your Markdown string, and get back the rendered HTML and extracted front matter.

import { renderer } from '@thamidu-nadun/md_parser';

const markdown = `
---
title: My Awesome Page
author: Gemini
---

# Hello, world!

This is my first post using this awesome parser. :tada:
`;

const { html, front_data } = renderer(markdown);

console.log('Front Matter:', front_data);
// Output: { title: 'My Awesome Page', author: 'Gemini' }

console.log('HTML Output:', html);
// Output: '<h1>Hello, world!</h1>
<p>This is my first post using this awesome parser. 🎉</p>'

🎨 Built-in Feature: Custom Callouts

Make your documentation pop with 5 different types of callout blocks. Just wrap your content, and the parser will transform it into beautifully styled HTML div elements, complete with icons.

| Markdown Syntax | Purpose | | --------------- | ---------------------------------- | | :::tip | A helpful tip or suggestion. | | :::note | A neutral piece of information. | | :::info | An important piece of information. | | :::warning | A warning or potential pitfall. | | :::error | An error or critical warning. |

Example in your Markdown file:

:::tip
Don't forget to stay hydrated! 💧
:::

[!NOTE] The rich styling for these callouts (colors, borders) is applied via CSS classes. For README.md files viewed directly on platforms like GitHub or NPM, we recommend using GitHub's native alert syntax for a consistent look, as your custom CSS won't be applied there.

Example for GitHub (README.md):

> [!TIP]
> Don't forget to stay hydrated! 💧

🔌 Extending the Parser

You can easily add any markdown-it compatible plugin using the inject_plugin function. For example, let's add a plugin to highlight text wrapped in ==.

import { renderer, inject_plugin } from "@thamidu-nadun/md_parser";
import markdownitMark from "markdown-it-mark";

// First, install the plugin: npm install markdown-it-mark

const highlightPlugin = {
  plugin: markdownitMark,
};

// Inject the new plugin
inject_plugin(highlightPlugin);

const markdown = "You can ==highlight text== very easily!";
const { html } = renderer(markdown);

console.log(html);
// Output: "<p>You can <mark>highlight text</mark> very easily!</p>"

📂 File Structure

Here's a quick look at the project's structure:

.
├── src/              # Source Code
│   ├── index.js      # Main parser logic, plugin registration, and exports.
│   └── callOut.js    # Definitions and rendering logic for the custom callout blocks.
├── test/             # Automated tests
│   └── index.test.js # Unit tests for the parser and its features.
├── package.json      # Project metadata, dependencies, and scripts.
└── README.md         # The file you are reading right now.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

📝 License

This project is licensed under the MIT License.