New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

remarkable-header-ids

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remarkable-header-ids

Remarkable plugin to auto generate unique header ids, highly customizable

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
187
4.47%
Maintainers
1
Weekly downloads
 
Created
Source

remarkable-header-ids NPM version NPM downloads Build Status

Autogenerate unique ids for text headers (h1,...h6)

Install

Install with npm:

$ npm install --save remarkable-header-ids

Usage

const HeaderIdsPlugin = require("remarkable-header-ids");
const Remarkable = require("remarkable");

const markdownParser = new Remarkable().use(
  HeaderIdsPlugin()
);

Options

Params

Option nameTypedefaultValueNote
levelsnumber[][1, 2, 3, 4, 5, 6]
anchorClassNamestring"header-anchor"
anchorTextstring"#"When anchorText is empty, the anchor will not be rendered at all
headerId(slug: string) => stringslug => "heading-#" + slug

Example

const Remarkable = require("remarkable");
const HeaderIdsPlugin = require("remarkable-header-ids");

const parser = new Remarkable().use(
  HeaderIdsPlugin({
    levels: [2], // only transform h2
    anchorClassName: "this-is-anchor-in-header",
    anchorText: "AnchorText",
    headerId: (slug) =>
      `header-that-has-this-anchor-${slug}`,
  })
);

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Please read the contributing guide for avice on opening issues, pull requests, and coding standards.

Tests

Test content is located inside the test directory. For more info regarding the internals of test suite, check out test/parse.js.

to run the test, execute npm test from the root directory. This script will render into test/parsed.html.

Author

Farzad Yousefzadeh

License

Copyright © 2020, github/farskid. Released under the MIT license.

Keywords

remarkable

FAQs

Package last updated on 06 Jun 2020

Did you know?

Socket

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.

Install

Related posts