Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

orchidjs/eleventy-plugin-ids

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eleventy-plugin-ids

Note

Eleventy 3.0.0 includes a new IdAttributePlugin. This official solution should be used if you don't need the extra features offered by this plugin like custom prefixes or formatters.

@11ty plugin for adding ids to html headings and other elements

<h1>Foo Bar</h1>

will become

<h1 id="foo-bar">Foo Bar</h1>

Installation

npm install @orchidjs/eleventy-plugin-ids

Basic Usage

Add eleventy-plugin-ids to your .eleventy.js file

module.exports = function(eleventyConfig) {
	//...
	
	const anchors_plugin = require('@orchidjs/eleventy-plugin-ids');
	eleventyConfig.addPlugin(anchors_plugin);
	
	//...
}

Settings

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-',
		}
	});
	
	//...
}

About

@11ty plugin for adding ids to html headings and other elements

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.