
Research
Using Trusted Protocols Against You: Gmail as a C2 Mechanism
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
Extend MDAST by parsing embedded HTML in Markdown. Converts HTML into structured MDAST nodes compatible with @m2d/core for DOCX generation.
@m2d/html
Parses embedded HTML into extended MDAST nodes to unlock full HTML-to-DOCX conversion support.
npm install @m2d/html
pnpm add @m2d/html
yarn add @m2d/html
The @m2d/html
plugin for mdast2docx
enables the parsing and transformation of embedded raw HTML inside Markdown into extended MDAST. This unlocks the ability to support features like images, tables, checkboxes, styles, and more — using HTML tags directly inside your Markdown documents.
This plugin must be registered early in the plugin pipeline.
It transforms raw HTML into extended MDAST nodes, which are then handled by other@m2d/*
plugins (such as@m2d/image
,@m2d/table
, etc).
If used after other plugins, the HTML content, e.g, images, tables, or lists may be ignored or lost in the DOCX output.
import { htmlPlugin } from "@m2d/html";
const plugins = [
htmlPlugin(), // ✅ Must come first
imagePlugin(),
tablePlugin(),
];
@m2d/*
plugins or the @m2d/core
package consume these extended nodes to generate DOCX output.This plugin enriches the AST to enable other plugins and core engine to convert it to docx.
HTML Element | MDAST Node | Notes |
---|---|---|
<img> | image | Supports styles and attributes |
<br> | break | Line breaks |
<strong> , <b> | strong | Bold text |
<em> , <i> | emphasis | Italics |
<del> , <s> | delete | Strike-through |
<a> | link | Hyperlinks |
<table> | table , row | Basic tables supported |
<input type="checkbox"> | checkbox | Readonly checkboxes |
<hr> | thematicBreak | Horizontal line |
<blockquote> | blockquote | Blockquotes |
Others | paragraph , etc. | Styled or inline nodes with rich AST |
text-align
, color
, background-color
font-weight
, font-style
, text-decoration
text-transform
border
, border-left
, etc.display: inline-block
and similar behaviors<style>
tags or CSS files are not supported.rowSpan
and colSpan
are not yet supported.While this plugin was originally experimental, it is now stable and production-ready.
It powers the rich HTML support in mdast2docx
, including checkboxes, tables, and styled images.
🧵 Contributions, ideas, and feedback are welcome! Open an issue or PR anytime.
Plugin | Purpose |
---|---|
@m2d/core | Converts extended MDAST to DOCX |
@m2d/image | Renders image nodes to DOCX |
@m2d/table | Renders table nodes to DOCX |
@m2d/list | Enhanced list support (tasks, bullets) |
If you find this useful:
MIT © Mayank Chaudhari
Made with 💖 by Mayank Kumar Chaudhari
FAQs
Extend MDAST by parsing embedded HTML in Markdown. Converts HTML into structured MDAST nodes compatible with @m2d/core for DOCX generation.
The npm package @m2d/html receives a total of 722 weekly downloads. As such, @m2d/html popularity was classified as not popular.
We found that @m2d/html demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.