Jacky Zhao
2023-08-04 3a2eae0a16cfc275182f8a26af0a77f0e9bd07c1
quartz/plugins/transformers/links.ts
@@ -47,6 +47,7 @@
                  return targetCanonical === fileName
                })
                // only match, just use it
                if (matchingFileNames.length === 1) {
                  const targetSlug = canonicalizeServer(matchingFileNames[0])
                  return (resolveRelative(curSlug, targetSlug) + targetAnchor) as RelativeURL
@@ -75,7 +76,7 @@
                // don't process external links or intra-document anchors
                if (!(isAbsoluteUrl(dest) || dest.startsWith("#"))) {
                  dest = node.properties.href = transformLink(dest)
                  const canonicalDest = path.normalize(joinSegments(curSlug, dest))
                  const canonicalDest = path.posix.normalize(joinSegments(curSlug, dest))
                  const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
                  outgoing.add(destCanonical as CanonicalSlug)
                }
@@ -99,7 +100,7 @@
                if (!isAbsoluteUrl(node.properties.src)) {
                  const ext = path.extname(node.properties.src)
                  node.properties.src =
                    transformLink(path.join("assets", node.properties.src)) + ext
                    transformLink(joinSegments("assets", node.properties.src)) + ext
                }
              }
            })