Jacky Zhao
2023-08-19 dd47be1bc65d3a8050d6ce9e77cd0e3b10e2a1a9
improve path resolution stability
5 files modified
15 ■■■■ changed files
quartz/components/PageList.tsx 2 ●●● patch | view | raw | blame | history
quartz/components/pages/FolderContent.tsx 4 ●●●● patch | view | raw | blame | history
quartz/components/renderPage.tsx 4 ●●●● patch | view | raw | blame | history
quartz/components/scripts/graph.inline.ts 2 ●●● patch | view | raw | blame | history
quartz/plugins/transformers/links.ts 3 ●●●● patch | view | raw | blame | history
quartz/components/PageList.tsx
@@ -56,7 +56,7 @@
                  <li>
                    <a
                      class="internal tag-link"
                      href={resolveRelative(fileData.slug!, `tags/${tag}/index` as FullSlug)}
                      href={resolveRelative(fileData.slug!, `tags/${tag}` as FullSlug)}
                    >
                      #{tag}
                    </a>
quartz/components/pages/FolderContent.tsx
@@ -5,11 +5,11 @@
import style from "../styles/listPage.scss"
import { PageList } from "../PageList"
import { simplifySlug } from "../../util/path"
import { _stripSlashes, simplifySlug } from "../../util/path"
function FolderContent(props: QuartzComponentProps) {
  const { tree, fileData, allFiles } = props
  const folderSlug = simplifySlug(fileData.slug!)
  const folderSlug = _stripSlashes(simplifySlug(fileData.slug!))
  const allPagesInFolder = allFiles.filter((file) => {
    const fileSlug = simplifySlug(file.slug!)
    const prefixed = fileSlug.startsWith(folderSlug) && fileSlug !== folderSlug
quartz/components/renderPage.tsx
@@ -25,7 +25,7 @@
    css: [joinSegments(baseDir, "index.css"), ...staticResources.css],
    js: [
      {
        src: joinSegments(baseDir, "/prescript.js"),
        src: joinSegments(baseDir, "prescript.js"),
        loadTime: "beforeDOMReady",
        contentType: "external",
      },
@@ -37,7 +37,7 @@
      },
      ...staticResources.js,
      {
        src: baseDir + "/postscript.js",
        src: joinSegments(baseDir, "postscript.js"),
        loadTime: "afterDOMReady",
        moduleType: "module",
        contentType: "external",
quartz/components/scripts/graph.inline.ts
@@ -177,7 +177,7 @@
      window.spaNavigate(new URL(targ, window.location.toString()))
    })
    .on("mouseover", function (_, d) {
      const neighbours: SimpleSlug[] = data[slug].links ?? []
      const neighbours: SimpleSlug[] = data[fullSlug].links ?? []
      const neighbourNodes = d3
        .selectAll<HTMLElement, NodeData>(".node")
        .filter((d) => neighbours.includes(d.id))
quartz/plugins/transformers/links.ts
@@ -60,7 +60,8 @@
                    dest,
                    transformOptions,
                  )
                  const canonicalDest = path.posix.normalize(joinSegments(curSlug, dest))
                  const url = new URL(dest, `https://base.com/${curSlug}`)
                  const canonicalDest = url.pathname
                  const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
                  const simple = simplifySlug(destCanonical as FullSlug)
                  outgoing.add(simple)