mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 11:36:23 +00:00
fix: dont transform external links
This commit is contained in:
parent
6ef4246cf1
commit
2d52eba413
1 changed files with 3 additions and 1 deletions
|
@ -54,7 +54,8 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options> | undefined> =
|
||||||
node.properties.className.push(isAbsoluteUrl(dest) ? "external" : "internal")
|
node.properties.className.push(isAbsoluteUrl(dest) ? "external" : "internal")
|
||||||
|
|
||||||
// don't process external links or intra-document anchors
|
// don't process external links or intra-document anchors
|
||||||
if (!(isAbsoluteUrl(dest) || dest.startsWith("#"))) {
|
const isInternal = !(isAbsoluteUrl(dest) || dest.startsWith("#"))
|
||||||
|
if (isInternal) {
|
||||||
dest = node.properties.href = transformLink(
|
dest = node.properties.href = transformLink(
|
||||||
file.data.slug!,
|
file.data.slug!,
|
||||||
dest,
|
dest,
|
||||||
|
@ -77,6 +78,7 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options> | undefined> =
|
||||||
// rewrite link internals if prettylinks is on
|
// rewrite link internals if prettylinks is on
|
||||||
if (
|
if (
|
||||||
opts.prettyLinks &&
|
opts.prettyLinks &&
|
||||||
|
isInternal &&
|
||||||
node.children.length === 1 &&
|
node.children.length === 1 &&
|
||||||
node.children[0].type === "text" &&
|
node.children[0].type === "text" &&
|
||||||
!node.children[0].value.startsWith("#")
|
!node.children[0].value.startsWith("#")
|
||||||
|
|
Loading…
Reference in a new issue