mirror of
https://github.com/quartz-community/utils.git
synced 2026-07-22 02:50:27 +00:00
build: rebuild dist with multi-segment path fix
This commit is contained in:
parent
1ad4e4f2f6
commit
8d2e14bcb9
4 changed files with 26 additions and 2 deletions
12
dist/index.js
vendored
12
dist/index.js
vendored
|
|
@ -160,7 +160,19 @@ function transformLink(src, target, opts) {
|
|||
const canonicalSlug = stripSlashes(targetSlug.slice(".".length));
|
||||
const [targetCanonical, targetAnchor] = splitAnchor(canonicalSlug);
|
||||
if (opts.strategy === "shortest") {
|
||||
const isMultiSegment = targetCanonical.includes("/");
|
||||
const isFolderTarget = isFolderPath(targetSlug);
|
||||
const matchingFileNames = opts.allSlugs.filter((slug) => {
|
||||
if (isMultiSegment) {
|
||||
if (slug === targetCanonical || slug.endsWith("/" + targetCanonical)) {
|
||||
return true;
|
||||
}
|
||||
if (isFolderTarget) {
|
||||
const withIndex = targetCanonical + "/index";
|
||||
return slug === withIndex || slug.endsWith("/" + withIndex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const parts = slug.split("/");
|
||||
const fileName = parts.at(-1);
|
||||
return targetCanonical === fileName;
|
||||
|
|
|
|||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
12
dist/path.js
vendored
12
dist/path.js
vendored
|
|
@ -157,7 +157,19 @@ function transformLink(src, target, opts) {
|
|||
const canonicalSlug = stripSlashes(targetSlug.slice(".".length));
|
||||
const [targetCanonical, targetAnchor] = splitAnchor(canonicalSlug);
|
||||
if (opts.strategy === "shortest") {
|
||||
const isMultiSegment = targetCanonical.includes("/");
|
||||
const isFolderTarget = isFolderPath(targetSlug);
|
||||
const matchingFileNames = opts.allSlugs.filter((slug) => {
|
||||
if (isMultiSegment) {
|
||||
if (slug === targetCanonical || slug.endsWith("/" + targetCanonical)) {
|
||||
return true;
|
||||
}
|
||||
if (isFolderTarget) {
|
||||
const withIndex = targetCanonical + "/index";
|
||||
return slug === withIndex || slug.endsWith("/" + withIndex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const parts = slug.split("/");
|
||||
const fileName = parts.at(-1);
|
||||
return targetCanonical === fileName;
|
||||
|
|
|
|||
2
dist/path.js.map
vendored
2
dist/path.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue