Skip to content

Commit

Permalink
fix: sluggify pound (closes jackyzha0#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 authored and qazxcdswe123 committed Apr 18, 2024
1 parent 70672e1 commit 49ab12f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions quartz/util/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ describe("transforms", () => {
["index.md", "index"],
["test.mp4", "test.mp4"],
["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.isFilePath,
Expand Down
4 changes: 3 additions & 1 deletion quartz/util/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export function getFullSlug(window: Window): FullSlug {
function sluggify(s: string): string {
return s
.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
.replace(/\/$/, "")
}
Expand Down

0 comments on commit 49ab12f

Please sign in to comment.