|
2 | 2 | import type { Props } from "@astrojs/starlight/props"; |
3 | 3 | import Default from "@astrojs/starlight/components/Head.astro"; |
4 | 4 | import { differenceInCalendarDays } from "date-fns"; |
5 | | -import "littlefoot/dist/littlefoot.css"; |
| 5 | +import "tippy.js/dist/tippy.css"; |
6 | 6 |
|
7 | 7 | import { getEntry } from "astro:content"; |
8 | 8 | import { getPageDescription } from "~/util/description"; |
@@ -164,51 +164,7 @@ if (Astro.props.entry.data.external_link) { |
164 | 164 | } |
165 | 165 | --- |
166 | 166 |
|
167 | | -<script> |
168 | | - import littlefoot from "littlefoot"; |
169 | | - |
170 | | - littlefoot(); |
171 | | - document |
172 | | - .querySelectorAll("span.littlefoot") |
173 | | - .forEach((x) => x.classList.add("not-content")); |
174 | | -</script> |
175 | | -<script> |
176 | | - import mermaid from "mermaid"; |
177 | | - |
178 | | - const diagrams = document.querySelectorAll<HTMLPreElement>("pre.mermaid"); |
179 | | - |
180 | | - let init = false; |
181 | | - |
182 | | - async function render() { |
183 | | - const theme = |
184 | | - document.documentElement.getAttribute("data-theme") === "light" |
185 | | - ? "neutral" |
186 | | - : "dark"; |
187 | | - |
188 | | - for (const diagram of diagrams) { |
189 | | - if (!init) { |
190 | | - diagram.setAttribute("data-diagram", diagram.textContent as string); |
191 | | - } |
192 | | - |
193 | | - const def = diagram.getAttribute("data-diagram") as string; |
194 | | - |
195 | | - mermaid.initialize({ startOnLoad: false, theme }); |
196 | | - await mermaid |
197 | | - .render(`mermaid-${crypto.randomUUID()}`, def) |
198 | | - .then(({ svg }) => (diagram.innerHTML = svg)); |
199 | | - |
200 | | - diagram.setAttribute("data-processed", "true"); |
201 | | - } |
202 | | - |
203 | | - init = true; |
204 | | - } |
205 | | - |
206 | | - const obs = new MutationObserver(() => render()); |
207 | | - |
208 | | - obs.observe(document.documentElement, { |
209 | | - attributes: true, |
210 | | - attributeFilter: ["data-theme"], |
211 | | - }); |
212 | | -</script> |
| 167 | +<script src="src/scripts/footnotes.ts"></script> |
| 168 | +<script src="src/scripts/mermaid.ts"></script> |
213 | 169 | <script src="src/scripts/analytics.ts"></script> |
214 | 170 | <Default {...Astro.props}><slot /></Default> |
0 commit comments