Closed thom4parisot closed 10 years ago
glad that you like it :)
since the results of slug()
are standard conform with what an URL can contain i don't plan on stripping :
out.
but how about a blacklist option for characters? would that help you?
I agree. While some punctuation may technically be part of a url slug, it is cleaner to strip them out. I am using this for a CMS and keep running into !
in the URLs. Maybe an option to strip out non-word characters (/\W/
)?
Thanks for the project.
Currently slug('yo! yo? yo& yo=')
yields yo!-yo-yoand-yo
which seems odd. I would expect it to yield yo-yo-yo-yo
Your problems are very specific and i still think the trade off between 'option' versus 'you do it' doesn't really pay off, or i'm just unable to see it.
function myslug(str, opts) {return slug(str.replace(/[!:&]/g,''), opts);}
> myslug("Devil May Cry 3 : l'Eveil de Dante")
'Devil-May-Cry-3-l\'Eveil-de-Dante'
> myslug("yo! yo? yo& yo=")
'yo-yo-yo-yo'
Fair enough.
If this library is for making URL safe slugs, it should follow RFC 1738 and not allow:
:
,(
,)
and @
"
,~
Hello,
thanks for your module. It works really really well :-) Except that at some point, it keeps some chars which are unusual for slugs.
Actually
Devil May Cry 3 : l'Eveil de Dante
is converted asdevil-may-cry-3-:-l'eveil-de-dante
. It would be cleaner to be converted asdevil-may-cry-3-leveil-de-dante
.Do you have any plan to support that? Or do you recommend a nice way to achieve such a result?