Gathering detailed insights and metrics for @gerhobbelt/markdown-it-github-headings
Gathering detailed insights and metrics for @gerhobbelt/markdown-it-github-headings
Gathering detailed insights and metrics for @gerhobbelt/markdown-it-github-headings
Gathering detailed insights and metrics for @gerhobbelt/markdown-it-github-headings
:octocat: Add anchors and links to headings just like Github does Add anchors and links to headings just like Github does
npm install @gerhobbelt/markdown-it-github-headings
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
24 Stars
30 Commits
8 Forks
5 Watchers
2 Branches
8 Contributors
Updated on Dec 09, 2024
Latest Version
2.0.0-2
Package Id
@gerhobbelt/markdown-it-github-headings@2.0.0-2
Unpacked Size
55.39 kB
Size
9.32 kB
File Count
15
NPM Version
6.14.11
Node Version
12.21.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
Add GitHub style anchor tags to headers
npm install --save @gerhobbelt/markdown-it-github-headings
1var md = require('@gerhobbelt/markdown-it')() 2 .use(require('@gerhobbelt/markdown-it-github-headings'), options) 3 4md.render('# hello')
The defaults will make the heading anchors behave as close to how GitHub behaves as possible.
Name | Description | Default |
---|---|---|
className | name of the class that will be added to the anchor tag | anchor |
prefixHeadingIds | add a prefix to each heading ID. (see security note below) | true |
prefix | if prefixHeadingIds is true, use this string to prefix each ID. | user-content- |
enableHeadingLinkIcons | Adds the icon next to each heading | true |
linkIcon | If enableHeadingLinkIcons is true, use this to supply a custom icon (or anything really) | |
resetSlugger | reset the slugger counter between .render calls for duplicate headers. (See tests for example) | true |
When using user generated content, its possible to run into DOM Clobbering when heading IDs are generated. Since IDs are used by JavaScript and CSS, a user could craft a page that breaks functionality or styles. A good way to avoid clobbering is to add a prefix to every generated ID to ensure they cannot overlap with existing IDs.
If you have full control over the content, there is less of a risk, but be aware that strange bugs related to DOM Clobbering are still possible!
For more information, here are some good resources on the topic:
One solution is to write some client side JavaScript to force non-prefixed hashes to jump to prefixed anchors. This is how its handled on GitHub and npmjs.com.
Check out marky-deep-links for an example (works great with browserify or webpack).
Contributions welcome! Please read the contributing guidelines first.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 5/24 approved changesets -- score normalized to 2
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
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
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