micromark-extension-gfm-table

micromark tokenizer extension for GFM table syntax

Library
npm
v2.1.1
7stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
26/100Needs Attention
Development Activity0
Maintenance32
Community12
Maturity60
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
70/100Good
Architecture75
Code Quality90
Innovation60
Learning Curve55

micromark-extension-gfm-table is a low-level tokenizer extension for the micromark markdown parser that adds support for GitHub Flavored Markdown table syntax (pipe-delimited rows with a header-separator line). It matches github.com’s own table parsing behavior, including column alignment markers (:---, :---:, ---:).

Like its sibling GFM extensions, it ships both a parsing extension (gfmTable()) and an HTML-compiling extension (gfmTableHtml()) so tables can be rendered straight to <table> HTML without building a syntax tree. It’s maintained under the micromark GitHub organization by Titus Wormer, and most consumers reach it transitively through micromark-extension-gfm or, for syntax-tree use, mdast-util-gfm-table/remark-gfm.

What You Get

  • gfmTable() — a micromark syntax extension that tokenizes GFM pipe-delimited tables, matching github.com’s parsing rules
  • gfmTableHtml() — an HTML-compiler extension rendering tables directly to <table>/<thead>/<tbody>/<tr>/<td> markup
  • Column alignment support (left/center/right) parsed from the header-separator row
  • Full TypeScript type definitions with 100% type coverage enforced at build time
  • GFM-spec-conformance fixtures generated via create-gfm-fixtures to track upstream behavior

Common Use Cases

  • Rendering markdown with tables directly to HTML via micromark, without constructing a full syntax tree
  • Composing a custom micromark-based markdown processor that needs GFM table support specifically
  • Used transitively by micromark-extension-gfm and, through mdast-util-gfm-table, by remark-gfm for full GitHub Flavored Markdown support

Under The Hood

Architecture The package is a micromark tokenizer extension implementing table-specific finite-state parsing: it must look ahead to the header-separator row before it can confirm a preceding row is a table header, which makes it noticeably more involved than simpler GFM extensions like strikethrough — reflected in its larger (~2,000-line) test/implementation footprint. A companion HTML-compiler extension hooks enter/exit events to emit standard HTML table markup with align styling derived from the separator row. Tech Stack Pure JavaScript authored with JSDoc types compiled via tsc --build + type-coverage, depending only on other micromark-util-*/micromark-factory-* helper packages and devlop for dev-mode assertions — no unrelated runtime dependencies. Code Quality The test/ directory exercises parsing and HTML output in both development and production conditions (test-api-dev/test-api-prod) with c8 --100 enforcing full coverage, and fixtures partly auto-generated via create-gfm-fixtures to stay aligned with GitHub’s actual table-rendering behavior. API Design The API mirrors the rest of the micromark-extension-gfm-* family: two factory-free extension objects meant to be spread into micromark’s extensions/htmlExtensions arrays, with no configuration options exposed since GFM table syntax has no variant behavior to toggle, unlike strikethrough’s singleTilde.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search