mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-26 13:26:22 +00:00
fix(assets): pdf page linking support. (#1025)
* github-slugger pdf workaround * Skip sluggifying on pdf file extension * Account for pdf files without anchor * Address feedback
This commit is contained in:
parent
0a2b52f618
commit
d75928ad5c
1 changed files with 3 additions and 0 deletions
|
@ -168,6 +168,9 @@ export function resolveRelative(current: FullSlug, target: FullSlug | SimpleSlug
|
||||||
|
|
||||||
export function splitAnchor(link: string): [string, string] {
|
export function splitAnchor(link: string): [string, string] {
|
||||||
let [fp, anchor] = link.split("#", 2)
|
let [fp, anchor] = link.split("#", 2)
|
||||||
|
if (fp.endsWith(".pdf")) {
|
||||||
|
return [fp, anchor === undefined ? "" : `#${anchor}`]
|
||||||
|
}
|
||||||
anchor = anchor === undefined ? "" : "#" + slugAnchor(anchor)
|
anchor = anchor === undefined ? "" : "#" + slugAnchor(anchor)
|
||||||
return [fp, anchor]
|
return [fp, anchor]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue