mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 11:36:23 +00:00
fix: sluggify pound (closes #681)
This commit is contained in:
parent
0a8c38dc21
commit
6babb788ed
2 changed files with 5 additions and 1 deletions
|
@ -105,6 +105,8 @@ describe("transforms", () => {
|
||||||
["index.md", "index"],
|
["index.md", "index"],
|
||||||
["test.mp4", "test.mp4"],
|
["test.mp4", "test.mp4"],
|
||||||
["note with spaces.md", "note-with-spaces"],
|
["note with spaces.md", "note-with-spaces"],
|
||||||
|
["test/special chars?.md", "test/special-chars-q"],
|
||||||
|
["test/special chars #3.md", "test/special-chars-3"],
|
||||||
],
|
],
|
||||||
path.slugifyFilePath,
|
path.slugifyFilePath,
|
||||||
path.isFilePath,
|
path.isFilePath,
|
||||||
|
|
|
@ -50,7 +50,9 @@ export function getFullSlug(window: Window): FullSlug {
|
||||||
function sluggify(s: string): string {
|
function sluggify(s: string): string {
|
||||||
return s
|
return s
|
||||||
.split("/")
|
.split("/")
|
||||||
.map((segment) => segment.replace(/\s/g, "-").replace(/%/g, "-percent").replace(/\?/g, "-q")) // slugify all segments
|
.map((segment) =>
|
||||||
|
segment.replace(/\s/g, "-").replace(/%/g, "-percent").replace(/\?/g, "-q").replace(/#/g, ""),
|
||||||
|
) // slugify all segments
|
||||||
.join("/") // always use / as sep
|
.join("/") // always use / as sep
|
||||||
.replace(/\/$/, "")
|
.replace(/\/$/, "")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue