@svelte-put/preprocess-auto-slug
v2.0.0
Published
Generate slug from text content, to add id to headings for example
Downloads
110
Maintainers
Readme
@svelte-put/preprocess-auto-slug
Svelte preprocessor for adding id
and anchor to nodes
svelte-put
This package is part of the @svelte-put family. For contributing guideline and more, refer to its readme.
Usage & Documentation
See the dedicated documentation page here.
Quick Start
<!-- input.svelte -->
<h2>Quick start</h2>
// svelte.config.js
import autoSlug from '@svelte-put/preprocess-auto-slug';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [autoSlug()],
};
export default config;
<!-- output.html -->
<h2 id="quick-start">
<a href="#quick-start" aria-hidden="true" tabindex="-1">#</a>
Quick Start
</h2>