Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markedjs/marked-custom-heading-id
Add custom id to headings with {#...} syntax
https://github.com/markedjs/marked-custom-heading-id
custom extension heading id marked
Last synced: 2 months ago
JSON representation
Add custom id to headings with {#...} syntax
- Host: GitHub
- URL: https://github.com/markedjs/marked-custom-heading-id
- Owner: markedjs
- License: mit
- Created: 2021-05-14T04:21:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-09T03:38:57.000Z (2 months ago)
- Last Synced: 2024-11-09T04:26:59.851Z (2 months ago)
- Topics: custom, extension, heading, id, marked
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/marked-custom-heading-id
- Size: 6.78 MB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# marked-custom-heading-id
Specify a custom heading id in headings with the [Markdown Extended Syntax](https://www.markdownguide.org/extended-syntax/#heading-ids) `# 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
```js
import { marked } from "marked";
import customHeadingId from "marked-custom-heading-id";// or UMD script
//
//marked.use(customHeadingId());
marked("# heading {#custom-id}");
//heading
```