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 syntax extension matches the GFM spec and github.com.
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.
This package is ESM only:
Node 12+ is needed to use it and it must be import
ed instead of require
d.
npm:
npm install micromark-extension-gfm-table
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
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
).
remarkjs/remark
— markdown processor powered by pluginsremarkjs/remark-gfm
— remark plugin using this and other GFM featuresmicromark/micromark
— the smallest commonmark-compliant markdown parser that existsmicromark/micromark-extension-gfm
— micromark extension combining this with other GFM featuressyntax-tree/mdast-util-gfm-table
— mdast utility to support tablessyntax-tree/mdast-util-gfm
— mdast utility to support GFMsyntax-tree/mdast-util-from-markdown
— mdast parser using micromark
to create mdast from markdownsyntax-tree/mdast-util-to-markdown
— mdast serializer to create markdown from mdastSee 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.