Gathering detailed insights and metrics for @rigor789/remark-autolink-headings
Gathering detailed insights and metrics for @rigor789/remark-autolink-headings
Gathering detailed insights and metrics for @rigor789/remark-autolink-headings
Gathering detailed insights and metrics for @rigor789/remark-autolink-headings
Deprecated remark plugin to add links to headings — please use `rehype-autolink-headings` instead
npm install @rigor789/remark-autolink-headings
Typescript
Module System
Node Version
NPM Version
67.6
Supply Chain
99.2
Quality
74.7
Maintenance
100
Vulnerability
100
License
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
63 Stars
126 Commits
14 Forks
9 Watchers
1 Branches
19 Contributors
Updated on Feb 21, 2025
Latest Version
5.1.0
Package Id
@rigor789/remark-autolink-headings@5.1.0
Unpacked Size
9.35 kB
Size
3.95 kB
File Count
5
NPM Version
5.6.0
Node Version
8.9.4
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
Automatically add links to headings in Markdown.
This package integrates with remark-html. It may be better to work with rehype, which is specifically made for HTML, and to use rehype-autolink-headings instead of this package.
With npm do:
npm install remark-autolink-headings --save
remark-autolink-headings is designed to work with remark-html & remark-slug, and creates GitHub style links for each of your headings.
Say we have the following markdown file, example.md
:
1# Lorem ipsum 😪 2## dolor—sit—amet 3### consectetur & adipisicing 4#### elit 5##### elit
And our script, example.js
, looks as follows:
1var fs = require('fs'); 2var unified = require('unified'); 3var markdown = require('remark-parse'); 4var html = require('remark-html'); 5var slug = require('remark-slug'); 6var headings = require('remark-autolink-headings'); 7 8var result = unified() 9 .use(markdown) 10 .use(slug) 11 // Note that this module must be included after remark-slug. 12 .use(headings) 13 .use(html) 14 .processSync(fs.readFileSync('example.md')) 15 .toString(); 16 17console.log(result);
Now, running node example
yields:
1<h1 id="lorem-ipsum-"><a href="#lorem-ipsum-" aria-hidden="true"><span class="icon icon-link"></span></a>Lorem ipsum 😪</h1> 2<h2 id="dolorsitamet"><a href="#dolorsitamet" aria-hidden="true"><span class="icon icon-link"></span></a>dolor—sit—amet</h2> 3<h3 id="consectetur--adipisicing"><a href="#consectetur--adipisicing" aria-hidden="true"><span class="icon icon-link"></span></a>consectetur & adipisicing</h3> 4<h4 id="elit"><a href="#elit" aria-hidden="true"><span class="icon icon-link"></span></a>elit</h4> 5<h5 id="elit-1"><a href="#elit-1" aria-hidden="true"><span class="icon icon-link"></span></a>elit</h5>
Type: string
Default: prepend
Set this to prepend
to inject the link before the heading text; append
after
it, and wrap
to wrap the whole heading text with the link. Note that supplying
wrap
will ignore any value defined by the content
option.
Type: Object|Array
Default: {type: 'element', tagName: 'span', properties: {className: [icon, `${icon}-${link}`]} }
Supply a list of HAST nodes or a single node here. For further details, please refer to the specification at https://github.com/syntax-tree/hast.
Type: object
By default, when using the append
or prepend
behaviour, this will add
aria-hidden="false"
to the anchor. When using the wrap
behaviour, this is
left empty for you to add any extra HTML attributes.
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
Project has not signed or included provenance with any releases.
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