Installations
npm install mdast-util-gfm-bn
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
18.17.0
NPM Version
9.6.7
Score
61.9
Supply Chain
98
Quality
75.1
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
282
Last Day
3
Last Week
6
Last Month
18
Last Year
147
GitHub Statistics
20 Stars
64 Commits
6 Forks
9 Watching
1 Branches
11 Contributors
Bundle Size
41.54 kB
Minified
16.63 kB
Minified + Gzipped
Sponsor this package
Package Meta Information
Latest Version
2.0.0
Package Id
mdast-util-gfm-bn@2.0.0
Unpacked Size
13.93 kB
Size
4.33 kB
File Count
4
NPM Version
9.6.7
Node Version
18.17.0
Publised On
28 Dec 2023
Total Downloads
Cumulative downloads
Total Downloads
282
Last day
0%
3
Compared to previous day
Last week
-25%
6
Compared to previous week
Last month
157.1%
18
Compared to previous month
Last year
8.9%
147
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
5
mdast-util-gfm
Extension for mdast-util-from-markdown
and/or
mdast-util-to-markdown
to support GitHub flavored markdown in
mdast.
When parsing (from-markdown
), must be combined with
micromark-extension-gfm
.
When to use this
Use this if you’re dealing with the AST manually and need all of GFM.
It’s probably nicer to use remark-gfm
with
remark, which includes this but provides a nicer interface and
makes it easier to combine with hundreds of plugins.
Alternatively, the extensions can be used separately:
syntax-tree/mdast-util-gfm-autolink-literal
— support GFM autolink literalssyntax-tree/mdast-util-gfm-footnote
— support GFM footnotessyntax-tree/mdast-util-gfm-strikethrough
— support GFM strikethroughsyntax-tree/mdast-util-gfm-table
— support GFM tablessyntax-tree/mdast-util-gfm-task-list-item
— support GFM tasklists
Install
This package is ESM only:
Node 12+ is needed to use it and it must be import
ed instead of require
d.
npm:
1npm install mdast-util-gfm
Use
Say we have the following file, example.md
:
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## Tasklist 23 24* [ ] to do 25* [x] done
And our module, example.js
, looks as follows:
1import fs from 'node:fs' 2import {fromMarkdown} from 'mdast-util-from-markdown' 3import {toMarkdown} from 'mdast-util-to-markdown' 4import {gfm} from 'micromark-extension-gfm' 5import {gfmFromMarkdown, gfmToMarkdown} from 'mdast-util-gfm' 6 7const doc = fs.readFileSync('example.md') 8 9const tree = fromMarkdown(doc, { 10 extensions: [gfm()], 11 mdastExtensions: [gfmFromMarkdown()] 12}) 13 14console.log(tree) 15 16const out = toMarkdown(tree, {extensions: [gfmToMarkdown()]}) 17 18console.log(out)
Now, running node example
yields:
1{ 2 type: 'root', 3 children: [ 4 {type: 'heading', depth: 1, children: [{type: 'text', value: 'GFM'}]}, 5 { 6 type: 'heading', 7 depth: 2, 8 children: [{type: 'text', value: 'Autolink literals'}] 9 }, 10 { 11 type: 'paragraph', 12 children: [ 13 { 14 type: 'link', 15 title: null, 16 url: 'http://www.example.com', 17 children: [{type: 'text', value: 'www.example.com'}] 18 }, 19 {type: 'text', value: ', '}, 20 { 21 type: 'link', 22 title: null, 23 url: 'https://example.com', 24 children: [{type: 'text', value: 'https://example.com'}] 25 }, 26 {type: 'text', value: ', and '}, 27 { 28 type: 'link', 29 title: null, 30 url: 'mailto:contact@example.com', 31 children: [{type: 'text', value: 'contact@example.com'}] 32 }, 33 {type: 'text', value: '.'} 34 ] 35 }, 36 {type: 'heading', depth: 2, children: [{type: 'text', value: 'Footnote'}]}, 37 { 38 type: 'paragraph', 39 children: [ 40 {type: 'text', value: 'A note'}, 41 {type: 'footnoteReference', identifier: '1', label: '1'} 42 ] 43 }, 44 { 45 type: 'footnoteDefinition', 46 identifier: '1', 47 label: '1', 48 children: [ 49 {type: 'paragraph', children: [{type: 'text', value: 'Big note.'}]} 50 ] 51 }, 52 { 53 type: 'heading', 54 depth: 2, 55 children: [{type: 'text', value: 'Strikethrough'}] 56 }, 57 { 58 type: 'paragraph', 59 children: [ 60 { 61 type: 'delete', 62 children: [{type: 'text', value: 'one'}] 63 }, 64 {type: 'text', value: ' or '}, 65 { 66 type: 'delete', 67 children: [{type: 'text', value: 'two'}] 68 }, 69 {type: 'text', value: ' tildes.'} 70 ] 71 }, 72 {type: 'heading', depth: 2, children: [{type: 'text', value: 'Table'}]}, 73 { 74 type: 'table', 75 align: [null, 'left', 'right', 'center'], 76 children: [ 77 { 78 type: 'tableRow', 79 children: [ 80 {type: 'tableCell', children: [{type: 'text', value: 'a'}]}, 81 {type: 'tableCell', children: [{type: 'text', value: 'b'}]}, 82 {type: 'tableCell', children: [{type: 'text', value: 'c'}]}, 83 {type: 'tableCell', children: [{type: 'text', value: 'd'}]} 84 ] 85 } 86 ] 87 }, 88 {type: 'heading', depth: 2, children: [{type: 'text', value: 'Tasklist'}]}, 89 { 90 type: 'list', 91 ordered: false, 92 start: null, 93 spread: false, 94 children: [ 95 { 96 type: 'listItem', 97 spread: false, 98 checked: false, 99 children: [ 100 {type: 'paragraph', children: [{type: 'text', value: 'to do'}]} 101 ] 102 }, 103 { 104 type: 'listItem', 105 spread: false, 106 checked: true, 107 children: [ 108 {type: 'paragraph', children: [{type: 'text', value: 'done'}]} 109 ] 110 } 111 ] 112 } 113 ] 114}
1# GFM 2 3## Autolink literals 4 5[www.example.com](http://www.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## Tasklist 23 24* [ ] to do 25* [x] done
API
This package exports the following identifiers: gfmFromMarkdown
,
gfmToMarkdown
.
There is no default export.
gfmFromMarkdown()
gfmToMarkdown(options?)
Support GFM.
The export of fromMarkdown
is a function that can be called and returns an
extension for mdast-util-from-markdown
.
The export of toMarkdown
is a function that can be called with options and
returns an extension for mdast-util-to-markdown
.
options
Passed as options
to mdast-util-gfm-table
.
Related
remarkjs/remark
— markdown processor powered by pluginsremarkjs/remark-gfm
— remark plugin to support GFMmicromark/micromark
— the smallest commonmark-compliant markdown parser that existsmicromark/micromark-extension-gfm
— micromark extension to parse GFMsyntax-tree/mdast-util-from-markdown
— mdast parser usingmicromark
to create mdast from markdownsyntax-tree/mdast-util-to-markdown
— mdast serializer to create markdown from mdast
Contribute
See contributing.md
in syntax-tree/.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
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/syntax-tree/.github/security.md:1
- Info: Found linked content: github.com/syntax-tree/.github/security.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/syntax-tree/.github/security.md:1
- Info: Found text in security policy: github.com/syntax-tree/.github/security.md:1
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 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/syntax-tree/mdast-util-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/syntax-tree/mdast-util-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/syntax-tree/mdast-util-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/syntax-tree/mdast-util-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
no effort to earn an OpenSSF best practices badge detected
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 SAST tool detected
Details
- Warn: no pull requests merged into dev branch
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'
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 More