Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orchidjs/eleventy-plugin-ids
@11ty plugin for adding ids to html headings and other elements
https://github.com/orchidjs/eleventy-plugin-ids
Last synced: 3 months ago
JSON representation
@11ty plugin for adding ids to html headings and other elements
- Host: GitHub
- URL: https://github.com/orchidjs/eleventy-plugin-ids
- Owner: orchidjs
- License: apache-2.0
- Created: 2021-07-07T03:32:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-13T21:59:00.000Z (over 1 year ago)
- Last Synced: 2024-04-20T01:43:06.472Z (7 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - orchidjs/eleventy-plugin-ids - @11ty plugin for adding ids to html headings and other elements (others)
README
# eleventy-plugin-ids
@11ty plugin for adding ids to html headings and other elements
```html
Foo Bar
```
will become```html
Foo Bar
```## Installation
```
npm install @orchidjs/eleventy-plugin-ids
```## Basic Usage
Add eleventy-plugin-ids to your .eleventy.js file
```js
module.exports = function(eleventyConfig) {
//...
const anchors_plugin = require('@orchidjs/eleventy-plugin-ids');
eleventyConfig.addPlugin(anchors_plugin);
//...
}
```## Settings
```js
module.exports = function(eleventyConfig) {
//...
const anchors_plugin = require('@orchidjs/eleventy-plugin-ids');
eleventyConfig.addPlugin(anchors_plugin,{
selectors: ['h1','h2','h3','h4','h5','h6'],
prefix: 'custom-id-prefix-',
formatter: function(element,existing_ids_array){
return '--generate-a-custom-id-here-',
}
});
//...
}
```