Skip to content

Commit

Permalink
fix(assets): pdf page linking support. (jackyzha0#1025)
Browse files Browse the repository at this point in the history
* github-slugger pdf workaround

* Skip sluggifying on pdf file extension

* Account for pdf files without anchor

* Address feedback
  • Loading branch information
saberzero1 authored and renyunkang committed Oct 29, 2024
1 parent d090be1 commit 31c7a08
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions quartz/util/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ export function resolveRelative(current: FullSlug, target: FullSlug | SimpleSlug

export function splitAnchor(link: string): [string, string] {
let [fp, anchor] = link.split("#", 2)
if (fp.endsWith(".pdf")) {
return [fp, anchor === undefined ? "" : `#${anchor}`]
}
anchor = anchor === undefined ? "" : "#" + slugAnchor(anchor)
return [fp, anchor]
}
Expand Down

0 comments on commit 31c7a08

Please sign in to comment.