Skip to content

Context-aware slugger, written in modern Javascript.

License

Notifications You must be signed in to change notification settings

guilherssousa/reslug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reslug

A library for generating unique slugs from strings. It's useful for generating URL slugs from titles, Markdown headings, etc. Zero dependencies, written in TypeScript, and works in Node.js (also Bun!) and the browser.

Installation

npm install reslug

Usage

import Reslug, { slug } from 'reslug';

const slugger = new Reslug();

slugger.slug('Hello, world!'); // hello-world
slugger.slug('Hello, world!'); // hello-world-1
slugger.slug('Hello, world!'); // hello-world-2
slugger.reset();
slugger.slug('Hello, world!'); // hello-world

// You can also use slug() function to generate
// slugs without context.
slug('Hello, world!'); // hello-world
slug('Hello, world!'); // hello-world

Acknowledgements

This library is a rewrite of github-slugger, made by Flet. You should check his project!

About

Context-aware slugger, written in modern Javascript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published