unified

Project: micromark/micromark-extension-gfm-table

Package: micromark-extension-gfm-table@1.0.0

  1. Dependents: 3
  2. micromark extension to support GFM tables
  1. unified 174
  2. markdown 131
  3. micromark 32
  4. gfm 18
  5. micromark-extension 15
  6. table 12
  7. cell 4
  8. row 3
  9. column 2
  10. tabular 2

micromark-extension-gfm-table

Build Coverage Downloads Size Sponsors Backers Chat

micromark extension to support GitHub flavored markdown (GFM) tables. This syntax extension matches the GFM spec and github.com.

When to use this

You should probably use micromark-extension-gfm instead, which combines this package with other GFM features. Alternatively, if you don’t want all of GFM, use this package.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install micromark-extension-gfm-table

Use

import {micromark} from 'micromark'
import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table'

const output = micromark('| a |\n| - |', {
  extensions: [gfmTable],
  htmlExtensions: [gfmTableHtml]
})

console.log(output)

Yields:

<table>
<thead>
<tr>
<th>a</th>
</tr>
</thead>
</table>

API

This package exports the following identifiers: gfmTable, gfmTableHtml. There is no default export.

The export map supports the endorsed development condition. Run node --conditions development module.js to get instrumented dev code. Without this condition, production code is loaded.

gfmTable

gfmTableHtml

An extension for micromark to parse tables (can be passed in extensions) and one to compile to <table> elements (can be passed in htmlExtensions).

Contribute

See contributing.md in micromark/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer