Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imcuttle/remark-heading-id
The remark plugin for supporting custom heading id
https://github.com/imcuttle/remark-heading-id
markdown remark remark-plugin
Last synced: about 1 month ago
JSON representation
The remark plugin for supporting custom heading id
- Host: GitHub
- URL: https://github.com/imcuttle/remark-heading-id
- Owner: imcuttle
- License: mit
- Created: 2019-02-27T11:30:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-11T10:18:47.000Z (about 1 year ago)
- Last Synced: 2024-12-24T05:41:24.799Z (about 2 months ago)
- Topics: markdown, remark, remark-plugin
- Language: JavaScript
- Size: 302 KB
- Stars: 33
- Watchers: 4
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: License
Awesome Lists containing this project
README
# remark-heading-id
[![Build status](https://img.shields.io/travis/imcuttle/remark-heading-id/master.svg?style=flat-square)](https://travis-ci.org/imcuttle/remark-heading-id)
[![Test coverage](https://img.shields.io/codecov/c/github/imcuttle/remark-heading-id.svg?style=flat-square)](https://codecov.io/github/imcuttle/remark-heading-id?branch=master)
[![NPM version](https://img.shields.io/npm/v/remark-heading-id.svg?style=flat-square)](https://www.npmjs.com/package/remark-heading-id)
[![NPM Downloads](https://img.shields.io/npm/dm/remark-heading-id.svg?style=flat-square&maxAge=43200)](https://www.npmjs.com/package/remark-heading-id)
[![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://prettier.io/)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)> The remark plugin for supporting [custom heading id](https://www.markdownguide.org/extended-syntax/#heading-ids) and
> Default Id### Custom Heading Input
```markdown
### My Great Heading {#custom-id}
```### Custom Heading Output
```html
My Great Heading
```### API
This package exports no identifiers. The default export is `remarkHeaderId`.
`unified().use(remarkHeadingId[, options])`
#### options
Configuration (optional).
#### options.defaults
Whether to add default ids based on the title text (boolean, default: false).
#### options.uniqueDefaults
Whether to ensure that the default ids created by options.defaults are unique (boolean, default: true).
Only relevant when options.defaults = true.
Example:```markdown
## heading### introduction
### argument
## heading
### introduction
### argument
```Will generate this output when options.defaults = true and options.uniqueDefaults = true:
```html
heading
indroduction
argument
heading
introduction
argument
```Instead of this output, which is generated when options.defaults = true and options.uniqueDefaults = false:
```html
heading
indroduction
argument
heading
introduction
argument
```The difference being that the last output contains duplicate ids in the generated html, which are avoided using
options.uniqueDefaults = true.##### Default Heading Input
```markdown
### My Great Heading
```##### Default Heading Output
```html
My Great Heading
```## Contributing
- Fork it!
- Create your new branch:
`git checkout -b feature-new` or `git checkout -b fix-which-bug`
- Start your magic work now
- Make sure npm test passes
- Commit your changes:
`git commit -am 'feat: some description (close #123)'` or `git commit -am 'fix: some description (fix #123)'`
- Push to the branch: `git push`
- Submit a pull request :)## Authors
This library is written and maintained by imcuttle, [email protected].
## License
MIT - [imcuttle](https://github.com/imcuttle) 🐟