JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1784384
  • Score
    100M100P100Q15528F
  • License MIT

Add anchors to remark heading nodes

Package Exports

  • remark-slug

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-slug) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

remark-slug Build Status Coverage Status

Add anchors to remark heading nodes using GitHub’s algorithm.

Works great with remark-html, used by remark-toc and remark-man.

Installation

npm:

npm install remark-slug

remark-slug is also available for duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

Dependencies:

var slug = require('remark-slug');
var remark = require('remark');
var html = require('remark-html');

Process:

var doc = remark().use(slug).use(html).process('# Foo bar');

Yields:

<h1 id="foo-bar">Foo bar</h1>

CLI

remark readme.md -u slug

API

remark.use(slug)

Adds slugs to markdown headings.

Sets data.id and data.htmlAttributes.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.

Parameters:

  • slug — This plugin.

License

MIT © Titus Wormer