Skip to content

Commit e31c6ba

Browse files
committed
chore: update from obsidian
1 parent 2178101 commit e31c6ba

8 files changed

Lines changed: 86 additions & 43 deletions

File tree

content/public/content/annotations/programming-as-theory-building.md

Lines changed: 14 additions & 14 deletions
Large diffs are not rendered by default.

content/public/content/notes/ai-beat-us.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: AI has already won — what's left for us, now?
3-
date: 1970-0im-15
3+
date: 1970-02-15
44
tags:
55
- engineering/ai
66
- engineering

quartz/components/AnnotationViewer.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ export default (() => {
113113
return (
114114
<div class={classNames(displayClass, "annotation-viewer")} data-pdf-url={localPdfPath} data-source-url={pdfUrl}>
115115
<script type="application/json" id="annotations-data" dangerouslySetInnerHTML={{ __html: JSON.stringify(sortedAnnotations) }} />
116+
117+
{/* SEO: Add semantic description for crawlers */}
118+
<div class="annotation-description" aria-label="About these annotations">
119+
<p>
120+
This page contains {sortedAnnotations.length} annotations and commentary on the source document.
121+
Each annotation includes the original text context, personal insights, and relevant connections.
122+
</p>
123+
</div>
124+
116125
<div class="annotation-source-citation">
117126
Source document retrieved from{" "}
118127
<a href={pdfUrl} target="_blank" rel="noopener noreferrer">
@@ -121,15 +130,16 @@ export default (() => {
121130
</div>
122131

123132
<div class="annotation-split-view">
124-
<div class="annotation-pdf-container">
133+
<div class="annotation-pdf-container" aria-label="Source document viewer">
125134
<div id="pdf-viewer" class="pdf-canvas-wrapper">
126135
{/* PDF.js will be injected here via client-side script */}
127-
<div class="pdf-loading">Loading PDF...</div>
136+
<div class="pdf-loading" aria-hidden="true">Loading PDF...</div>
128137
</div>
129138
</div>
130139

131140
<div class="annotation-sidebar">
132-
<div class="annotation-list">
141+
<article class="annotation-list" role="main" aria-label="Annotations">
142+
<h2 class="annotation-list-heading">Annotations</h2>
133143
{sortedAnnotations.map(annotation => {
134144
const textQuote = annotation.target?.[0]?.selector?.find(
135145
s => s.type === "TextQuoteSelector"
@@ -139,14 +149,16 @@ export default (() => {
139149
)
140150

141151
return (
142-
<div
152+
<article
143153
class="annotation-item"
144154
data-annotation-id={annotation.id}
145155
data-start={textPosition?.start}
146156
data-end={textPosition?.end}
157+
itemScope
158+
itemType="https://schema.org/Comment"
147159
>
148160
{annotation.text && (
149-
<div class="annotation-comment">
161+
<div class="annotation-comment" itemProp="text">
150162
<div dangerouslySetInnerHTML={{ __html: annotation.text }} />
151163
</div>
152164
)}
@@ -160,14 +172,14 @@ export default (() => {
160172
)}
161173

162174
<div class="annotation-meta">
163-
<time datetime={annotation.created}>
175+
<time datetime={annotation.created} itemProp="dateCreated">
164176
{new Date(annotation.created).toLocaleDateString()}
165177
</time>
166178
</div>
167-
</div>
179+
</article>
168180
)
169181
})}
170-
</div>
182+
</article>
171183
</div>
172184
</div>
173185
</div>

quartz/components/scripts/annotationViewer/main.inline.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ import { renderHighlights, renderAllHighlights, setActiveHighlight } from "./cor
44

55
// Wrap in IIFE and handle multiple initialization scenarios
66
;(async () => {
7-
// Check if annotation viewer exists on the page before loading resources
8-
const viewer = document.querySelector(".annotation-viewer")
9-
if (!viewer) return
10-
11-
// Load PDF.js library and CSS
12-
await loadPDFLib()
13-
147
/**
158
* Initialize annotation viewer (with duplicate check)
169
*/
@@ -22,6 +15,9 @@ import { renderHighlights, renderAllHighlights, setActiveHighlight } from "./cor
2215
if (viewer.getAttribute("data-initialized") === "true") return
2316
viewer.setAttribute("data-initialized", "true")
2417

18+
// Load PDF.js library on first encounter
19+
await loadPDFLib()
20+
2521
// Load annotations data and initialize viewer
2622
loadAnnotationsData()
2723
await initPDFViewer()

quartz/components/scripts/annotationViewer/ui/loader.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
/**
2-
* Load PDF.js library from CDN
2+
* Load PDF.js library from CDN (idempotent)
33
*/
44
export async function loadPDFLib(): Promise<void> {
5+
// Return early if PDF.js is already loaded
6+
if (window.pdfjsLib) {
7+
return
8+
}
9+
510
// Load PDF.js viewer CSS from CDN and scope it to .annotation-viewer
611
// This prevents PDF.js's bare selectors from affecting the rest of the page
712
if (!document.querySelector('style[data-annotation-viewer-scoped-css]')) {

quartz/components/styles/annotationViewer.scss

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@
22
// Use full width to let flex children determine size naturally
33
width: 100%;
44
max-width: none;
5-
padding-left: 2rem;
6-
padding-right: 2rem;
5+
// No padding - rely on parent #quartz-body padding to avoid double-padding
76
height: 100vh;
87
overflow: hidden;
8+
}
99

10-
@media all and (max-width: 1250px) {
11-
padding-left: 1.5rem;
12-
padding-right: 1.5rem;
13-
}
10+
// SEO: Description visible to crawlers but hidden from visual users
11+
.annotation-description {
12+
position: absolute;
13+
left: -10000px;
14+
width: 1px;
15+
height: 1px;
16+
overflow: hidden;
1417

15-
@media all and (max-width: 600px) {
16-
padding-left: 1rem;
17-
padding-right: 1rem;
18+
// Ensure screen readers and crawlers can still access
19+
&:not(:focus):not(:active) {
20+
clip: rect(0 0 0 0);
21+
clip-path: inset(50%);
1822
}
1923
}
2024

@@ -134,6 +138,15 @@
134138
gap: 1.5rem;
135139
}
136140

141+
.annotation-list-heading {
142+
font-size: 1.25rem;
143+
font-weight: 600;
144+
margin: 0 0 1rem 0;
145+
padding-bottom: 0.5rem;
146+
border-bottom: 2px solid var(--lightgray);
147+
color: var(--darkgray);
148+
}
149+
137150
.annotation-item {
138151
padding: 1rem;
139152
background: var(--light);

quartz/layouts/annotations.layout.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export const annotationsLayout: PageLayout = {
2727
localGraph: defaultLocalGraphOptions,
2828
globalGraph: defaultGraphOptions,
2929
}),
30+
Component.EmailSubscribe({
31+
title: "Subscribe for more!",
32+
description: "Be notified weekly about any fresh notes or articles!",
33+
}),
3034
Component.Backlinks(),
3135
],
3236
left: [],

quartz/styles/base.scss

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,28 @@ body.full-width .page {
404404
margin: 0 auto;
405405

406406
>#quartz-body {
407-
grid-template-columns: auto;
407+
grid-template-columns: 1fr;
408408
grid-template-areas:
409409
"grid-page-header"
410410
"grid-center"
411411
"grid-footer";
412412
padding: 0 2rem;
413413

414+
// Reduce padding when annotation viewer is present to maximize width
415+
&:has(.annotation-viewer) {
416+
padding: 0 1rem;
417+
418+
@media all and ($tablet) {
419+
padding: 0 0.75rem;
420+
}
421+
422+
@media all and ($mobile) {
423+
padding: 0 0.5rem;
424+
}
425+
}
426+
414427
@media all and ($tablet) {
415-
grid-template-columns: auto;
428+
grid-template-columns: 1fr;
416429
grid-template-areas:
417430
"grid-page-header"
418431
"grid-center"
@@ -421,7 +434,7 @@ body.full-width .page {
421434
}
422435

423436
@media all and ($mobile) {
424-
grid-template-columns: auto;
437+
grid-template-columns: 1fr;
425438
grid-template-areas:
426439
"grid-page-header"
427440
"grid-center"

0 commit comments

Comments
 (0)