Skip to content

#400 - slugify: strip_tags option, multibyte lowercase, explicit error on non-string inputs, document the default transliterator - #401

Merged
njoubert-cleverage merged 1 commit into
mainfrom
400
Nov 3, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
400

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #400.

  • strip_tags option (bool, true by default, unchanged behaviour): false keeps a text that is not HTML. strip_tags() removes everything after a < that does not open a tag: "Tom<Jerry" gave tom, "<3 love" gave "".
  • Lowercase: mb_strtolower() instead of strtolower(), so that the non-ASCII letters kept by a custom transliterator or replace pattern are lowercased too. No change with the default options: the default replace removes them anyway.
  • Inputs: a scalar or a \Stringable is cast to string (an int threw a TypeError). null, an array or another object throws an UnexpectedValueException with the type, instead of a raw TypeError.
  • Documentation: the default transliterator only removes the accents. The letters that are not decomposed are then removed ("Cœur" becomes c_ur, "Straße" stra_e, "Łódź" odz). Any-Latin; Latin-ASCII is recommended.

The defaults (transliterator, strip_tags) are unchanged: changing them is left to v6.0.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None. An int, float, bool or \Stringable input, which threw a TypeError, is now slugified.

🤖 Generated with Claude Code

…r on non-string inputs, document the default transliterator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage requested a review from a team as a code owner November 3, 2026 09:42
@njoubert-cleverage
njoubert-cleverage merged commit 1045543 into main Nov 3, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

slugify: letters without decomposition removed by default, strip_tags() truncating at a '<', no multibyte lowercase, TypeError on non-string inputs

1 participant