Skip to content

Commit

Permalink
Trim leading and trailing hyphens from slug
Browse files Browse the repository at this point in the history
  • Loading branch information
aidantwoods committed May 5, 2020
1 parent 2937c91 commit b3580ef
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Configurables/HeaderSlug.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function __construct($enabled, $slugCallback = null)
$slug = \mb_strtolower($text);
$slug = \str_replace(' ', '-', $slug);
$slug = \preg_replace('/[^\p{L}\p{Nd}\p{Nl}\p{M}-]+/u', '', $slug);
$slug = \trim($slug, '-');

return $slug;
};
Expand Down

0 comments on commit b3580ef

Please sign in to comment.