Installations
npm install markdown-it-toc-and-anchor
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
10.15.0
NPM Version
6.4.1
Score
96.1
Supply Chain
99.5
Quality
77.4
Maintenance
100
Vulnerability
98.9
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
medfreeman
Download Statistics
Total Downloads
7,133,697
Last Day
4,839
Last Week
22,120
Last Month
103,760
Last Year
1,101,358
GitHub Statistics
60 Stars
123 Commits
36 Forks
5 Watching
173 Branches
9 Contributors
Bundle Size
262.33 kB
Minified
91.40 kB
Minified + Gzipped
Package Meta Information
Latest Version
4.2.0
Package Id
markdown-it-toc-and-anchor@4.2.0
Unpacked Size
30.96 kB
Size
8.31 kB
File Count
6
NPM Version
6.4.1
Node Version
10.15.0
Total Downloads
Cumulative downloads
Total Downloads
7,133,697
Last day
-11.7%
4,839
Compared to previous day
Last week
-19.6%
22,120
Compared to previous week
Last month
13.5%
103,760
Compared to previous month
Last year
-5.6%
1,101,358
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
markdown-it-toc-and-anchor
markdown-it plugin to add toc and anchor links in headings
Installation
1$ yarn add markdown-it-toc-and-anchor
Usage
ES6
1import markdownIt from "markdown-it" 2import markdownItTocAndAnchor from "markdown-it-toc-and-anchor" 3 4markdownIt({ 5 html: true, 6 linkify: true, 7 typographer: true, 8 }) 9 .use(markdownItTocAndAnchor, { 10 // ...options 11 }) 12 .render(md)
ES5 / CommonJS
1var markdownIt = require('markdown-it'), 2 markdownItTocAndAnchor = require('markdown-it-toc-and-anchor').default; 3 4markdownIt({ 5 html: true, 6 linkify: true, 7 typographer: true, 8 }) 9 .use(markdownItTocAndAnchor, { 10 // ...options 11 }) 12 .render(md)
:information_source: Note that the 'default' property has to be used when requiring this plugin, this is due to the use of Babel 6 now making ES6 compliant exports (Misunderstanding ES6 Modules, Upgrading Babel, Tears, and a Solution )
Options
toc
(default: true
)
Allows you to enable/disable the toc transformation of @[toc]
tocClassName
(default: "markdownIt-TOC"
)
Option to customize html class of the <ul>
wrapping the toc. If no class is wanted set to null
.
tocFirstLevel
(default: 1
)
Allows you to skip some heading level. Example: use 2 if you want to skip <h1>
from the TOC.
tocLastLevel
(default: 6
)
Allows you to skip some heading level. Example: use 5 if you want to skip <h6>
from the TOC.
tocCallback
(default: null
)
Allows you to get toc contents externally by executing a callback function returning toc elements, in addition / instead of using @[toc] tag in content. Example :
markdownIt({
html: true,
linkify: true,
typographer: true,
})
.use(markdownItTocAndAnchor, {
tocCallback: function(tocMarkdown, tocArray, tocHtml) {
console.log(tocHtml)
}
})
.render(md)
To allow callback to be more flexible, this option is also available in global markdown-it options, and in render environment. Example :
Callback in global markdown-it options
var mdIt = markdownIt({
html: true,
linkify: true,
typographer: true,
})
.use(markdownItTocAndAnchor)
....
mdIt.set({
tocCallback: function(tocMarkdown, tocArray, tocHtml) {
console.log(tocHtml)
}
})
.render(md)
Callback in render environment
var mdIt = markdownIt({
html: true,
linkify: true,
typographer: true,
})
.use(markdownItTocAndAnchor)
....
mdIt
.render(md, {
tocCallback: function(tocMarkdown, tocArray, tocHtml) {
console.log(tocHtml)
}
})
anchorLink
(default: true
)
Allows you to enable/disable the anchor link in the headings
anchorLinkSymbol
(default: "#"
)
Allows you to customize the anchor link symbol
anchorLinkSpace
(default: true
)
Allows you to enable/disable inserting a space between the anchor link and heading.
anchorLinkSymbolClassName
(default: null
)
Allows you to customize the anchor link symbol class name. If not null, symbol will be rendered as <span class="anchorLinkSymbolClassName">anchorLinkSymbol</span>
.
anchorLinkBefore
(default: true
)
Allows you to prepend/append the anchor link in the headings
anchorLinkPrefix
(default: undefined
)
Allows you to add a prefix to the generated header ids, e.g. section-
.
anchorClassName
(default: "markdownIt-Anchor"
)
Allows you to customize the anchor link class. If no class is wanted set to null
.
wrapHeadingTextInAnchor
(default: false
)
Makes the entire heading into the anchor link (takes precedence over anchorLinkSymbol
and anchorLinkBefore
)
resetIds
(default: true
)
Allows you to reset (or not) ids incrementation. Use it if you will have multiple documents on the same page.
slugify
(default: uses the uslug
package)
Allows you to customize the slug function that create ids from string.
Ex:
1 // ... 2 slugify : string => `/some/prefix/${string.replace(/(\/| |')/g, "_")}` 3 // ...
CONTRIBUTING
- ⇄ Pull requests and ★ Stars are always welcome.
- For bugs and feature requests, please create an issue.
- Pull requests must be accompanied by passing automated tests (
$ npm test
).
CHANGELOG
LICENSE
Stable Version
Stable Version
4.2.0
HIGH
1
7.5/10
Summary
Denial of Service in markdown-it-toc-and-anchor
Affected Versions
< 4.2.0
Patched Versions
4.2.0
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 1/29 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
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
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 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Reason
63 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-6chw-6frg-f759
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm
- Warn: Project is vulnerable to: GHSA-3gx7-xhv7-5mx3
- Warn: Project is vulnerable to: GHSA-qx4v-6gc5-f2vv
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-h726-x36v-rx45
- Warn: Project is vulnerable to: GHSA-6vfc-qv3f-vr6c
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp
- Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr
- Warn: Project is vulnerable to: GHSA-7xcx-6wjh-7xp2
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/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 markdown-it-toc-and-anchor
markdown-it-github-toc
markdown-it plugin to add toc and anchor links in headings
@hikerpig/markdown-it-toc-and-anchor
markdown-it plugin to add toc and anchor links in headings
markdown-it-toc-and-anchor-fork
markdown-it plugin to add toc and anchor links in headings
@gerhobbelt/markdown-it-toc-and-anchor
markdown-it plugin to add toc and anchor links in headings