From 24348b24a94c5f9ca285642b751e6798b92eedd9 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 20 Jun 2023 05:50:25 +0000
Subject: [PATCH] fix: parsing wikilinks that have codeblock anchors, scroll to anchor

---
 quartz/components/scripts/search.inline.ts |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts
index b1c6265..78517fe 100644
--- a/quartz/components/scripts/search.inline.ts
+++ b/quartz/components/scripts/search.inline.ts
@@ -1,6 +1,6 @@
 import { Document } from "flexsearch"
 import { ContentDetails } from "../../plugins/emitters/contentIndex"
-import { registerEscapeHandler } from "./handler"
+import { registerEscapeHandler, relative, removeAllChildren } from "./util"
 
 interface Item {
   slug: string,
@@ -9,16 +9,6 @@
 }
 let index: Document<Item> | undefined = undefined
 
-function relative(from: string, to: string) {
-  const pieces = [location.protocol, '//', location.host, location.pathname]
-  const url = pieces.join('').slice(0, -from.length) + to
-  return url
-}
-
-function removeAllChildren(node: HTMLElement) {
-  node.innerHTML = ``
-}
-
 const contextWindowWords = 30
 function highlight(searchTerm: string, text: string, trim?: boolean) {
   const tokenizedTerms = searchTerm.split(/\s+/).filter(t => t !== "")

--
Gitblit v1.10.0