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

@m2d/html

v1.1.12

Published

Extend MDAST by parsing embedded HTML in Markdown. Converts HTML into structured MDAST nodes compatible with @m2d/core for DOCX generation.

Readme

@m2d/html

@m2d/html: HTML to Extended MDAST preprocessing plugin for @m2d/core. Transforms raw embedded HTML strings into structured MDAST nodes for rich Word DOCX conversion.


✨ Features

  • 🌐 Embedded HTML Parsing: Converts raw HTML tags inside Markdown into structured MDAST nodes, enabling HTML-to-Word generation.
  • 🎨 Inline CSS Resolution: Extracts and translates inline CSS (color, background-color, text-align, font-weight, font-size, borders) into native Word OpenXML styling.
  • 🧩 Deep Ecosystem Integration: Upgrades raw <img>, <table>, and list tags so that downstream plugins (@m2d/image, @m2d/table, @m2d/list) can process them seamlessly.
  • ☑️ Interactive Elements: Translates <input type="checkbox"> elements into clean Unicode checkbox representations (☑ / ☐).
  • ⚡ Lightweight DOM Parsing: Fast, robust stack-based parsing that pairs closing tags across sibling Markdown nodes without mangling surrounding content.

📦 Installation

$ pnpm add @m2d/html @m2d/core docx

or

$ npm install @m2d/html @m2d/core docx

or

$ yarn add @m2d/html @m2d/core docx

🚀 Quick Start

import { toDocx } from "@m2d/core";
import { htmlPlugin } from "@m2d/html";
import { imagePlugin } from "@m2d/image";
import { tablePlugin } from "@m2d/table";
import remarkParse from "remark-parse";
import { unified } from "unified";

const markdown = `
# Project Report

<span style="color: #2563EB; font-weight: bold;">Important Alert:</span>
The schedule has moved forward by 2 weeks.

<table>
  <tr>
    <th style="background-color: #1E293B; color: #FFFFFF;">Milestone</th>
    <th style="background-color: #1E293B; color: #FFFFFF;">Target</th>
  </tr>
  <tr>
    <td>Alpha Release</td>
    <td>November 1st</td>
  </tr>
</table>
`;

const mdast = unified().use(remarkParse).parse(markdown);

const docxBlob = await toDocx(mdast, {}, {
  plugins: [
    htmlPlugin(),  // 1. MUST BE REGISTERED FIRST: Converts raw HTML to MDAST nodes
    tablePlugin(), // 2. Formats table nodes generated by htmlPlugin
    imagePlugin(), // 3. Rasterizes image nodes generated by htmlPlugin
  ],
});

⚠️ Important Pipeline Order: Always register htmlPlugin() at the beginning of your plugins array. It executes during the preprocess phase to generate the MDAST nodes that subsequent plugins rely upon.


📚 Deep Dive Guides


License

This library is licensed under the MIT open-source license.