Skip to content

Commit

Permalink
Delete double spaces in wikilink slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
H0R5E committed Apr 22, 2024
1 parent ce5cc89 commit f0bd6d2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ const tocOptions = {

const pageResolver = (name) => {
const fixed = name
.replace(/&(#(?:x[0-9a-f]+|\d+)|[a-z]+);?/gi, "")
.replace(/[^a-zA-Z0-9 ]/g, "")
.replace(/ /g, "-")
.replace(/&(#(?:x[0-9a-f]+|\d+)|[a-z]+);?/gi, "") // Remove HTML character entities
.replace(/[^a-zA-Z0-9 ]/g, "") // Remove non alpha numeric character
.replace(/ +(?= )/g, "") // Remove multiple spaces
.replace(/ /g, "-") // Replace single space with dash
.toLowerCase();
return [fixed];
};
Expand Down

0 comments on commit f0bd6d2

Please sign in to comment.