Gathering detailed insights and metrics for @bwagener/remark-slug
Gathering detailed insights and metrics for @bwagener/remark-slug
Gathering detailed insights and metrics for @bwagener/remark-slug
Gathering detailed insights and metrics for @bwagener/remark-slug
plugin to add anchors to headings using GitHub’s algorithm
npm install @bwagener/remark-slug
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
120 Commits
2 Branches
1 Contributors
Updated on Nov 29, 2020
Latest Version
4.2.4
Package Id
@bwagener/remark-slug@4.2.4
Unpacked Size
7.04 kB
Size
3.15 kB
File Count
4
NPM Version
6.12.0
Node Version
12.13.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
Add anchors to remark heading nodes using GitHub’s algorithm.
:warning: This is often useful when compiling to HTML. If you’re doing that, it’s probably smarter to use
remark-rehype
andrehype-slug
and benefit from the rehype ecosystem.
npm:
1npm install remark-slug
Say we have the following file, example.md
:
1# Lorem ipsum 😪 2 3## dolor—sit—amet 4 5### consectetur & adipisicing 6 7#### elit 8 9##### elit
And our script, example.js
, looks as follows:
1var fs = require('fs'); 2var unified = require('unified'); 3var markdown = require('remark-parse'); 4var slug = require('remark-slug'); 5var remark2rehype = require('remark-rehype'); 6var html = require('rehype-stringify'); 7 8unified() 9 .use(markdown) 10 .use(slug) 11 .use(remark2rehype) 12 .use(html) 13 .process(fs.readFileSync('example.md'), function (err, file) { 14 if (err) throw err; 15 console.log(String(file)); 16 });
Now, running node example
yields:
1<h1 id="lorem-ipsum-">Lorem ipsum 😪</h1> 2<h2 id="dolorsitamet">dolor—sit—amet</h2> 3<h3 id="consectetur--adipisicing">consectetur & adipisicing</h3> 4<h4 id="elit">elit</h4> 5<h5 id="elit-1">elit</h5>
remark.use(slug)
Adds slugs to markdown headings.
Uses github-slugger (thus creating GitHub style id
s).
Sets data.id
, data.hProperties.id
on heading nodes. The first can be
used by any plugin as a unique identifier, the second tells remark-html
to use its value as an id
attribute. remark-slug does not overwrite
these values when they already exist.
rehype-slug
— Add slugs to headings in HTMLNo vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
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
no SAST tool detected
Details
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
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