
Security News
Node.js Homepage Adds Paid Support Link, Prompting Contributor Pushback
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
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: { ... },
firstRowProps: { ... },
firstRowCellProps: { ... },
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 |
Vertical Alignment | CENTER |
Horizontal Alignment | Based on Markdown or CENTER fallback |
| Name | Age | City |
| :---: | :-: | --------: |
| Alice | 24 | New York |
| Bob | 30 | San Diego |
docx.Table
, docx.TableRow
, docx.TableCell
, and docx.Paragraph
MDAST.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 3,224 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.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.
Research
Security News
The Socket Research Team investigates a malicious Python typosquat of a popular password library that forces Windows shutdowns when input is incorrect.