
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
remark-autolink-headings
Advanced tools
Automatically add links to headings in Markdown.
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:
var remark = require('remark');
var html = require('remark-html');
var slug = require('remark-slug');
var headings = require('remark-autolink-headings');
var markdown = '# Hello';
var result = remark().use([ slug, headings, html ]).processSync(markdown);
console.log(result);
//=> <h1 id="hello"><a href="#hello" aria-hidden="true"><span class="icon icon-link"></span></a>Hello</h1>
Note that this module must be included after remark-slug.
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/wooorm/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
FAQs
Deprecated: this package is no longer maintained. Please use `remark-rehype` to move from remark (markdown) to rehype (HTML) and then replace `remark-autolink-headings` with [`rehype-autolink-headings`][rehype-autolink-headings].
The npm package remark-autolink-headings receives a total of 14,441 weekly downloads. As such, remark-autolink-headings popularity was classified as popular.
We found that remark-autolink-headings demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.