Skip to content

Commit ceef873

Browse files
committed
Quartz sync: Mar 16, 2026, 1:40 AM
1 parent a8c77d2 commit ceef873

8 files changed

Lines changed: 127 additions & 30 deletions
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
tags:
3+
- machine-learning
4+
- "#projects"
5+
- "#gsoc"
6+
---
7+
# Motivation
8+
Gas kinematics reveals still-forming planets in images of disks through features called *kinks*.
9+
10+
# Basic Idea
11+
[[Denoising Astronomical Observations of Protoplanetary Disks#Bibliography|Terry et al. (2022)]] use [[Latin Hypercube|latin hypercube]] to distribute randomly-spaced data points evenly across the whole parameter space.
12+
13+
# Bibliography
14+
1. *Locating Hidden Exoplanets in ALMA Data Using Machine Learning*: https://iopscience.iop.org/article/10.3847/1538-4357/aca477

content/research/On inertial forces (indirect terms) in problems with a central body.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,3 @@ abstract: |-
3939
generalized to other astrophysical systems.
4040
journal_logo: arxiv.svg
4141
---
42-
$$
43-
\dfrac{}{}
44-
$$

content/tools/Hunting Planets Using Machine Learning.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

quartz.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const config: QuartzConfig = {
7777
Plugin.Latex({ renderEngine: "mathjax" }),
7878
Plugin.Citations({
7979
linkCitations: true,
80+
suppressBibliography: true,
8081
}),
8182
// Plugin.FootnotesToReferences(),
8283
Plugin.PaperPreviewInjector(),

quartz/components/Head.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export default (() => {
9797
return resource
9898
}
9999
})}
100+
<script src={`${baseDir}/static/citation-popover.js`}></script>
100101
</head>
101102
)
102103
}
Lines changed: 69 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
1+
import fs from "fs"
2+
import path from "path"
3+
14
import rehypeCitation from "rehype-citation"
25
import { PluggableList } from "unified"
36
import { visit } from "unist-util-visit"
47
import { QuartzTransformerPlugin } from "../types"
58

9+
function field(body: string, name: string) {
10+
const r = new RegExp(name + "\\s*=\\s*\\{([^}]+)\\}", "i")
11+
const m = body.match(r)
12+
return m ? m[1] : ""
13+
}
14+
15+
function parseBibFile(filePath: string) {
16+
const text = fs.readFileSync(filePath, "utf8")
17+
const entries: Record<string, any> = {}
18+
19+
const entryRegex = /@.+?\{([^,]+),([\s\S]*?)\n\}/g
20+
21+
let match
22+
while ((match = entryRegex.exec(text)) !== null) {
23+
const key = match[1].trim().toLowerCase()
24+
const body = match[2]
25+
26+
const doi = field(body, "doi")
27+
const url = field(body, "url")
28+
29+
entries[key] = {
30+
title: field(body, "title"),
31+
author: field(body, "author"),
32+
year: field(body, "year"),
33+
journal: field(body, "journal") || field(body, "booktitle"),
34+
link: doi ? `https://doi.org/${doi}` : url
35+
}
36+
}
37+
38+
return entries
39+
}
40+
641
export interface Options {
742
bibliographyFile: string
843
suppressBibliography: boolean
@@ -12,28 +47,27 @@ export interface Options {
1247

1348
const defaultOptions: Options = {
1449
bibliographyFile: "./bibliography.bib",
15-
suppressBibliography: false,
16-
linkCitations: false,
50+
suppressBibliography: true,
51+
linkCitations: true,
1752
csl: "apa",
1853
}
1954

2055
export const Citations: QuartzTransformerPlugin<Partial<Options>> = (userOpts) => {
2156
const opts = { ...defaultOptions, ...userOpts }
57+
2258
return {
2359
name: "Citations",
2460
htmlPlugins(ctx) {
2561
const plugins: PluggableList = []
26-
// per default, rehype-citations only supports en-US
27-
// see: https://github.com/timlrx/rehype-citation/issues/12
28-
// in here there are multiple usable locales:
29-
// https://github.com/citation-style-language/locales
30-
// thus, we optimistically assume there is indeed an appropriate
31-
// locale available and simply create the lang url-string
62+
3263
let lang: string = "en-US"
3364
if (ctx.cfg.configuration.locale !== "en-US") {
3465
lang = `https://raw.githubusercontent.com/citation-stylelanguage/locales/refs/heads/master/locales-${ctx.cfg.configuration.locale}.xml`
3566
}
36-
// Add rehype-citation to the list of plugins
67+
68+
const bibPath = path.resolve(opts.bibliographyFile)
69+
const citationData = parseBibFile(bibPath)
70+
3771
plugins.push([
3872
rehypeCitation,
3973
{
@@ -45,13 +79,32 @@ export const Citations: QuartzTransformerPlugin<Partial<Options>> = (userOpts) =
4579
},
4680
])
4781

48-
// Transform the HTML of the citattions; add data-no-popover property to the citation links
49-
// using https://github.com/syntax-tree/unist-util-visit as they're just anochor links
5082
plugins.push(() => {
51-
return (tree, _file) => {
52-
visit(tree, "element", (node, _index, _parent) => {
53-
if (node.tagName === "a" && node.properties?.href?.startsWith("#bib")) {
54-
node.properties["data-no-popover"] = true
83+
return (tree) => {
84+
visit(tree, "element", (node: any) => {
85+
if (
86+
node.tagName === "a" &&
87+
typeof node.properties?.href === "string" &&
88+
node.properties.href.startsWith("#bib-")
89+
) {
90+
const key = node.properties.href.replace("#bib-", "").toLowerCase()
91+
const entry = citationData[key]
92+
93+
if (entry?.link) {
94+
node.properties.href = entry.link
95+
node.properties.target = "_blank"
96+
node.properties.rel = "noopener noreferrer"
97+
98+
node.properties["data-cite-title"] = entry.title
99+
node.properties["data-cite-author"] = entry.author
100+
node.properties["data-cite-year"] = entry.year
101+
node.properties["data-cite-journal"] = entry.journal
102+
103+
node.properties.className = [
104+
...(node.properties.className || []),
105+
"citation-link",
106+
]
107+
}
55108
}
56109
})
57110
}
@@ -60,4 +113,4 @@ export const Citations: QuartzTransformerPlugin<Partial<Options>> = (userOpts) =
60113
return plugins
61114
},
62115
}
63-
}
116+
}

quartz/static/citation-popover.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
document.addEventListener("DOMContentLoaded", () => {
2+
const pop = document.createElement("div")
3+
pop.className = "citation-popover"
4+
document.body.appendChild(pop)
5+
6+
document.querySelectorAll("a.citation-link").forEach((el) => {
7+
el.addEventListener("mouseenter", () => {
8+
const title = el.dataset.citeTitle || ""
9+
const author = el.dataset.citeAuthor || ""
10+
const year = el.dataset.citeYear || ""
11+
const journal = el.dataset.citeJournal || ""
12+
13+
pop.innerHTML =
14+
"<strong>" + title + "</strong><br>" +
15+
author + " (" + year + ")<br>" +
16+
journal
17+
18+
const rect = el.getBoundingClientRect()
19+
pop.style.left = rect.left + window.scrollX + "px"
20+
pop.style.top = rect.bottom + window.scrollY + 8 + "px"
21+
pop.style.display = "block"
22+
})
23+
24+
el.addEventListener("mouseleave", () => {
25+
pop.style.display = "none"
26+
})
27+
})
28+
})

quartz/styles/custom.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,4 +384,18 @@ a.data-footnote-backref {
384384
.global-graph-container {
385385
width: 100vw;
386386
height: 100vh;
387+
}
388+
389+
.citation-popover {
390+
position: absolute;
391+
max-width: 320px;
392+
padding: 10px;
393+
background: var(--light);
394+
border: 1px solid var(--border);
395+
border-radius: 6px;
396+
font-size: 0.85rem;
397+
line-height: 1.4;
398+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
399+
display: none;
400+
z-index: 1000;
387401
}

0 commit comments

Comments
 (0)