Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
micromark-extension-gfm-table
Advanced tools
The micromark-extension-gfm-table npm package is a plugin for the micromark Markdown parser that adds support for GitHub Flavored Markdown (GFM) tables. This extension allows developers to parse and render tables in Markdown text according to the GFM specification, which is particularly useful for projects that need to handle GitHub-style Markdown.
Parsing GFM tables
This feature allows the parsing of GitHub Flavored Markdown tables into HTML. The code sample demonstrates how to use the micromark parser with the gfm-table extension to convert a simple Markdown table into HTML.
const micromark = require('micromark');
const gfmTable = require('micromark-extension-gfm-table');
const markdown = '| Header 1 | Header 2 |\n| --------- | --------- |\n| Cell 1 | Cell 2 |';
const html = micromark(markdown, {
extensions: [gfmTable]
});
console.log(html);
markdown-it is a Markdown parser that can be extended with plugins, similar to micromark. It supports GFM tables through its own plugin system. Compared to micromark-extension-gfm-table, markdown-it provides a more comprehensive solution with additional plugins for various Markdown extensions, making it versatile but potentially heavier.
remark-gfm is a plugin for the remark Markdown processor that adds support for GFM features, including tables. It is part of the unified collective and works in the ecosystem involving remark and rehype for processing Markdown and HTML respectively. Compared to micromark-extension-gfm-table, remark-gfm is typically used in a broader processing pipeline that can handle a wide range of transformations and outputs.
micromark extension to support GitHub flavored markdown (GFM) tables.
This package is a micromark extension to add support for GFM tables.
It matches how tables work on github.com
.
In many cases, when working with micromark, you’d want to use
micromark-extension-gfm
instead, which combines
this package with other GFM features.
When working with syntax trees, you’d want to combine this package with
mdast-util-gfm-table
(or
mdast-util-gfm
when using micromark-extension-gfm
).
These tools are all rather low-level.
In most cases, you’d instead want to use remark-gfm
with
remark.
This package is ESM only. In Node.js (version 12.20+, 14.14+, or 16.0+), install with npm:
npm install micromark-extension-gfm-table
In Deno with Skypack:
import {gfmTable, gfmTableHtml} from 'https://cdn.skypack.dev/micromark-extension-gfm-table@1?dts'
In browsers with Skypack:
<script type="module">
import {gfmTable, gfmTableHtml} from 'https://cdn.skypack.dev/micromark-extension-gfm-table@1?min'
</script>
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>
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
An extension for micromark to parse GFM tables (can be passed in extensions
).
gfmTableHtml
An extension to compile them to HTML (can be passed in htmlExtensions
).
This package is fully typed with TypeScript. There are no additional exported types.
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, and 16.0+. It also works in Deno and modern browsers.
This package is safe.
syntax-tree/mdast-util-gfm-table
— support GFM tables in mdastsyntax-tree/mdast-util-gfm
— support GFM in mdastremarkjs/remark-gfm
— support GFM in remarkSee 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.
FAQs
micromark extension to support GFM tables
The npm package micromark-extension-gfm-table receives a total of 2,954,529 weekly downloads. As such, micromark-extension-gfm-table popularity was classified as popular.
We found that micromark-extension-gfm-table demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.