micromark extension to support GFM (GitHub Flavored Markdown)
Installations
npm install micromark-extension-gfm
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
20.0.0
NPM Version
9.6.4
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
320,205,537
Last Day
771,754
Last Week
3,586,611
Last Month
15,577,709
Last Year
170,215,749
GitHub Statistics
31 Stars
75 Commits
2 Forks
7 Watching
1 Branches
12 Contributors
Bundle Size
23.24 kB
Minified
7.03 kB
Minified + Gzipped
Sponsor this package
Package Meta Information
Latest Version
3.0.0
Package Id
micromark-extension-gfm@3.0.0
Unpacked Size
19.84 kB
Size
5.77 kB
File Count
5
NPM Version
9.6.4
Node Version
20.0.0
Publised On
26 Jun 2023
Total Downloads
Cumulative downloads
Total Downloads
320,205,537
Last day
-4.9%
771,754
Compared to previous day
Last week
-12.6%
3,586,611
Compared to previous week
Last month
7.3%
15,577,709
Compared to previous month
Last year
84.7%
170,215,749
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
8
micromark-extension-gfm
micromark extensions to support GitHub flavored markdown (GFM).
Contents
- What is this?
- When to use this
- Install
- Use
- API
- Bugs
- Authoring
- HTML
- CSS
- Syntax
- Types
- Compatibility
- Security
- Contribute
- License
What is this?
This package contains extensions that add support for all features enabled by
GFM to micromark
.
It supports autolink literals, footnotes, strikethrough, tables, tagfilter, and
tasklists.
When to use this
This project is useful when you want to support GFM in markdown.
You can use these extensions when you are working with micromark
.
Alternatively, you can also use the underlying features separately:
micromark-extension-gfm-autolink-literal
— support GFM autolink literalsmicromark-extension-gfm-footnote
— support GFM footnotesmicromark-extension-gfm-strikethrough
— support GFM strikethroughmicromark-extension-gfm-table
— support GFM tablesmicromark-extension-gfm-tagfilter
— support GFM tagfiltermicromark-extension-gfm-task-list-item
— support GFM tasklists
When you need a syntax tree, combine this package with
mdast-util-gfm
.
All these packages are used in remark-gfm
, which focusses on
making it easier to transform content by abstracting these internals away.
Install
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install micromark-extension-gfm
In Deno with esm.sh
:
1import {gfm, gfmHtml} from 'https://esm.sh/micromark-extension-gfm@3'
In browsers with esm.sh
:
1<script type="module"> 2 import {gfm, gfmHtml} from 'https://esm.sh/micromark-extension-gfm@3?bundle' 3</script>
Use
Say our document example.md
contains:
1# GFM 2 3## Autolink literals 4 5www.example.com, https://example.com, and contact@example.com. 6 7## Footnote 8 9A note[^1] 10 11[^1]: Big note. 12 13## Strikethrough 14 15~one~ or ~~two~~ tildes. 16 17## Table 18 19| a | b | c | d | 20| - | :- | -: | :-: | 21 22## Tag filter 23 24<plaintext> 25 26## Tasklist 27 28* [ ] to do 29* [x] done
…and our module example.js
looks as follows:
1import fs from 'node:fs/promises' 2import {micromark} from 'micromark' 3import {gfm, gfmHtml} from 'micromark-extension-gfm' 4 5const output = micromark(await fs.readFile('example.md'), { 6 allowDangerousHtml: true, 7 extensions: [gfm()], 8 htmlExtensions: [gfmHtml()] 9}) 10 11console.log(output)
…now running node example.js
yields:
1<h1>GFM</h1> 2<h2>Autolink literals</h2> 3<p><a href="http://www.example.com">www.example.com</a>, <a href="https://example.com">https://example.com</a>, and <a href="mailto:contact@example.com">contact@example.com</a>.</p> 4<h2>Footnote</h2> 5<p>A note<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></p> 6<h2>Strikethrough</h2> 7<p><del>one</del> or <del>two</del> tildes.</p> 8<h2>Table</h2> 9<table> 10<thead> 11<tr> 12<th>a</th> 13<th align="left">b</th> 14<th align="right">c</th> 15<th align="center">d</th> 16</tr> 17</thead> 18</table> 19<h2>Tag filter</h2> 20<plaintext> 21<h2>Tasklist</h2> 22<ul> 23<li><input type="checkbox" disabled="" /> to do</li> 24<li><input type="checkbox" disabled="" checked="" /> done</li> 25</ul> 26<section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> 27<ol> 28<li id="user-content-fn-1"> 29<p>Big note. <a href="#user-content-fnref-1" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩</a></p> 30</li> 31</ol> 32</section>
API
This package exports the identifiers gfm
and
gfmHtml
.
There is no default export.
The separate extensions support the development
condition.
Run node --conditions development module.js
to get instrumented dev code.
Without this condition, production code is loaded.
gfm(options?)
Create an extension for micromark
to enable GFM syntax.
Parameters
options
(Options
, optional) — configuration; passed tomicromark-extens-gfm-strikethrough
Returns
Extension for micromark
that can be passed in extensions
to enable GFM
syntax (Extension
).
gfmHtml(options?)
Create an extension for micromark
to support GFM when serializing to HTML.
Parameters
options
(HtmlOptions
, optional) — configuration; passed tomicromark-extens-gfm-footnote
Returns
Extension for micromark
that can be passed in htmlExtensions
to support GFM
when serializing to HTML (HtmlExtension
).
Options
Configuration for syntax (TypeScript type).
Type
1export type {Options} from 'micromark-extension-gfm-strikethrough'
HtmlOptions
Configuration for HTML (TypeScript type).
Type
1export type {HtmlOptions} from 'micromark-extension-gfm-footnote'
Bugs
For bugs present in GFM but not here, or other peculiarities that are supported, see each corresponding readme:
- autolink literal
- footnote
- strikethrough: n/a
- table
- tagfilter: n/a
- tasklists: n/a
Authoring
For recommendations on how to author GFM, see each corresponding readme:
- autolink literal
- footnote
- strikethrough
- table
- tagfilter: n/a
- tasklists
HTML
For info on what HTML features GFM relates to, see each corresponding readme:
CSS
For info on how GitHub styles these features, see each corresponding readme:
- autolink literal
- footnote
- strikethrough
- table
- tagfilter: n/a
- tasklists
Syntax
For info on the syntax of these features, see each corresponding readme:
- autolink literal
- footnote
- strikethrough
- table
- tagfilter: n/a
- tasklists
Types
This package is fully typed with TypeScript.
It exports the additional types HtmlOptions
and
Options
.
Compatibility
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
micromark-extension-gfm@^3
, compatible with Node.js 16.
This package works with micromark
version 3
and later.
Security
This package is safe.
Setting clobberPrefix = ''
is dangerous, it opens you up to DOM clobbering.
The labelTagName
and labelAttributes
options are unsafe when used with user
content, they allow defining arbitrary HTML.
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
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: license:0
- Info: FSF or OSI recognized license: MIT License: license:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/micromark/.github/security.md:1
- Info: Found linked content: github.com/micromark/.github/security.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/micromark/.github/security.md:1
- Info: Found text in security policy: github.com/micromark/.github/security.md:1
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/bb.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/micromark/micromark-extension-gfm/bb.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/micromark/micromark-extension-gfm/main.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/micromark/micromark-extension-gfm/main.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/micromark/micromark-extension-gfm/main.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/main.yml:15
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/bb.yml:1
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 1 are checked with a SAST tool
Score
4.1
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to micromark-extension-gfm
micromark-extension-gfm-table
micromark extension to support GFM tables
micromark-extension-gfm-strikethrough
micromark extension to support GFM strikethrough
micromark-extension-gfm-footnote
micromark extension to support GFM footnotes
micromark-extension-gfm-tagfilter
micromark extension to support GFM tagfilter