CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-sindresorhus--slugify

Slugify a string with comprehensive Unicode transliteration and extensive customization options

94

1.34x
Overview
Eval results
Files

task.mdevals/scenario-3/

Blog Post URL Generator

Build a utility that converts blog post titles into clean, URL-friendly slugs for use in a content management system.

@generates

Requirements

Your utility must handle various types of blog post titles and convert them into clean, URL-safe slugs suitable for use in web addresses. The slugs should be readable, consistent, and work across different languages.

Core Functionality

The utility should:

  • Convert any blog post title into a URL-safe format
  • Handle special characters and punctuation appropriately
  • Support international characters from multiple languages (Latin, Cyrillic, Arabic, etc.)
  • Process titles with mixed case and convert them appropriately for URLs
  • Handle multiple consecutive spaces or special characters gracefully
  • Clean up leading and trailing whitespace

Specific Behaviors

  1. Special Symbols: Common symbols should be converted to readable text where appropriate
  2. Unicode Support: Non-ASCII characters should be converted to their ASCII equivalents (e.g., "Déjà" → "deja")
  3. Word Separation: Words in the title should be clearly separated in the slug
  4. Programming Style Names: Identifiers written in camelCase or PascalCase should have their words properly separated

Test Cases

  • Converting "Hello World" produces a slug with words separated by hyphens and all lowercase @test
  • Converting "I ♥ Dogs" produces "i-love-dogs" @test
  • Converting "Déjà Vu!" produces "deja-vu" @test
  • Converting "fooBar" produces "foo-bar" @test

API

/**
 * Converts a blog post title into a URL-friendly slug
 * @param {string} title - The blog post title to convert
 * @returns {string} A URL-safe slug
 */
function generateSlug(title) {
  // Implementation
}

module.exports = { generateSlug };

Dependencies { .dependencies }

@sindresorhus/slugify { .dependency }

Provides string-to-slug conversion with Unicode support.

Install with Tessl CLI

npx tessl i tessl/npm-sindresorhus--slugify

tile.json