mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Trim leading and trailing hyphens from slug
This commit is contained in:
parent
d8bf07535c
commit
4e99e29d28
@ -25,6 +25,7 @@ final class HeaderSlug implements Configurable
|
|||||||
$slug = \mb_strtolower($text);
|
$slug = \mb_strtolower($text);
|
||||||
$slug = \str_replace(' ', '-', $slug);
|
$slug = \str_replace(' ', '-', $slug);
|
||||||
$slug = \preg_replace('/[^\p{L}\p{Nd}\p{Nl}\p{M}-]+/u', '', $slug);
|
$slug = \preg_replace('/[^\p{L}\p{Nd}\p{Nl}\p{M}-]+/u', '', $slug);
|
||||||
|
$slug = \trim($slug, '-');
|
||||||
|
|
||||||
return $slug;
|
return $slug;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user