
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@m2d/table
Advanced tools
Plugin to convert Markdown tables (MDAST) to DOCX with support for rich formatting and seamless integration into mdast2docx.
@m2d/table 
A plugin that converts Markdown tables into rich, styled Word tables with full alignment, border, and header support.
npm install @m2d/table
pnpm add @m2d/table
yarn add @m2d/table
The @m2d/table plugin for mdast2docx renders Markdown tables into Word-compatible tables with customizable layout, alignment, and cell styling using the docx library.
Automatically handles header rows, borders, shading, cell alignments, and padding — all configurable.
docx.Table elementsleft, center, right)import { toDocx } from "@m2d/core";
import { tablePlugin } from "@m2d/table";
const plugins = [tablePlugin()];
const buffer = await toDocx(mdastTree, {
plugins,
});
The tablePlugin accepts an optional configuration object:
tablePlugin({
tableProps: { ... },
rowProps: { ... },
cellProps: {
... // CellProps
data: { bold: true, color: "#000000" } // Paragraph and Run styling options
},
firstRowProps: { ... },
firstRowCellProps: {
data: { bold: true, alignment: AlignmentType.CENTER } // Header cell styling
},
alignments: {
defaultHorizontalAlign: AlignmentType.CENTER,
defaultVerticalAlign: VerticalAlign.CENTER,
preferMdData: true,
},
});
All options override the following sensible defaults:
| Property | Default Value |
|---|---|
| Table Width | 100% (percentage) |
| Border Style | SINGLE, size 1 |
| Cell Padding | 2–4mm margins (top/bottom/left/right) |
| Header Row | Bold with shaded background #b79c2f |
| Cell Styling | Full docx.js paragraph & run options |
| Vertical Alignment | CENTER |
| Horizontal Alignment | Based on Markdown or CENTER fallback |
data PropertyThe data property provides comprehensive styling control using docx.js paragraph and text run options:
IRunOptions)bold, italics, underline, strike, doubleStrikecolor, size (font size in half-points)font (font family), highlight, shadingsuperScript, subScript, smallCaps, allCapsIParagraphOptions)alignment - text alignment (LEFT, CENTER, RIGHT, JUSTIFIED)spacing - line spacing and paragraph spacingindent - left, right, first line, hanging indentsnumbering, bullet, stylepre: true - preserves spaces, newline for code blockstablePlugin({
cellProps: {
data: {
font: "Arial",
size: 20, // 10pt font
color: "#333333",
spacing: { after: 120 }, // 6pt spacing after
},
},
firstRowCellProps: {
data: {
bold: true,
alignment: AlignmentType.CENTER,
color: "#ffffff",
size: 24, // 12pt font
font: "Calibri",
},
},
});
| Name | Age | City |
| :---: | :-: | --------: |
| Alice | 24 | New York |
| Bob | 30 | San Diego |
docx.Table, docx.TableRow, docx.TableCell, and docx.ParagraphMDAST.align[]@m2d/core’s block plugin APInode.type = ""If you find this useful:
MIT © Mayank Chaudhari
Made with 💖 by Mayank Kumar Chaudhari
FAQs
Plugin to convert Markdown tables (MDAST) to DOCX with support for rich formatting and seamless integration into mdast2docx.
The npm package @m2d/table receives a total of 5,061 weekly downloads. As such, @m2d/table popularity was classified as popular.
We found that @m2d/table 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
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.