npm.io
0.2.5 • Published 16h ago

@mdast2docx/mdast

Licence
MIT
Version
0.2.5
Deps
1
Size
7 kB
Vulns
0
Weekly
0
Stars
1

@m2d/mdast

CI codecov npm version npm downloads npm bundle size license

@m2d/mdast: Extended Markdown & Hypertext Abstract Syntax Tree (MDAST/HAST) TypeScript type definitions and utilities for the @m2d DOCX compiler ecosystem.


Features

  • Extended MDAST Specifications: Augmented node definitions tailored for rich document authoring (SVG, Checkbox, Fragment).
  • Enhanced Table Models: Widened TableCell model supporting block content (RootContent[]), enabling lists, paragraphs, and quotes inside table cells.
  • Lifecycle State Control (EmptyNode): Standardized mechanism for marking AST nodes as consumed to prevent duplicate processing across multi-plugin passes.
  • HAST Type Definitions: Full HTML AST definitions (@m2d/mdast/hast) powering HTML preprocessing and React Markdown compilation.
  • TypeScript Helpers: Deep type utilities including Optional<T>, Mutable<T>, and Immutable<T>.

Installation

This package (@mdast2docx/mdast) is an official alias of @m2d/mdast.

Why does this exist?

We provide this package to offer shorter import paths and improved discoverability. While both packages provide identical functionality, @m2d/mdast is the primary source of truth.

Which one should I use?
  • Use @mdast2docx/mdast if you prefer the shorter name or specific branding or ESM Only.
  • Use @m2d/mdast for the most stable long-term reference and standard alignment.
Feature @m2d/mdast @mdast2docx/mdast
Source Code Primary Proxy
Updates Immediate Synchronized (Immediately)
Bundle Size 100% 100% (Zero overhead)
Format ESM + CJS ESM Only
Maintenance Primary Proxy (inherits)
Security Primary Proxy (inherits)
Maintenance & Support

Security: Security audits are performed on the canonical package; this alias inherits all security patches automatically.


$ pnpm add @m2d/mdast

or

$ npm install @m2d/mdast

or

$ yarn add @m2d/mdast

Quick Start

import type { Checkbox, Fragment, RootContent, SVG } from "@m2d/mdast";

// Strongly-typed extended SVG node
const svgNode: SVG = {
  type: "svg",
  value: "<svg viewBox='0 0 100 100'>...</svg>",
  data: {
    mermaid: "graph TD; A-->B;",
  },
};

// Strongly-typed interactive checkbox node
const checkboxNode: Checkbox = {
  type: "checkbox",
  checked: true,
};

Deep Dive Guides


License

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


with by Mayank Kumar Chaudhari

Keywords