marked-custom-heading-id
TypeScript icon, indicating that this package has built-in type declarations

2.0.14 • Public • Published

marked-custom-heading-id

Specify a custom heading id in headings with the Markdown Extended Syntax # heading {#custom-id}

The heading will be rendered with the string between {# and }

The id must be a valid id with the following criteria:

  • Must start with a letter (A-Z, a-z)
  • Must only contain word characters (A-Z, a-z, 0-9, _) or dashes (-)

Usage

import { marked } from "marked";
import customHeadingId from "marked-custom-heading-id";

// or UMD script
// <script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
// <script src="https://cdn.jsdelivr.net/npm/marked-custom-heading-id/lib/index.umd.js"></script>

marked.use(customHeadingId());

marked("# heading {#custom-id}");
// <h1 id="custom-id">heading</h1>

Package Sidebar

Install

npm i marked-custom-heading-id

Weekly Downloads

591

Version

2.0.14

License

MIT

Unpacked Size

6.71 kB

Total Files

8

Last publish

Collaborators

  • tonybrix