Skip to content

Commit 383725f

Browse files
committed
Quartz sync: May 25, 2025, 3:52 PM
1 parent 3a89ef5 commit 383725f

File tree

6 files changed

+213
-91
lines changed

6 files changed

+213
-91
lines changed
Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
aliases:
23
description:
34
tags:
45
- gtd
@@ -9,45 +10,43 @@ tags:
910
- context/tool
1011
- context/energy
1112
created: 2025-05-18
12-
modified: 2025-05-18
13+
modified: 2025-05-25
1314
---
1415

1516
# GTD Workflow
16-
17-
```mermaid
18-
flowchart TD
19-
20-
A[Is it Actionable?] -->|Yes| B(Single Step to complete?)
21-
A --> |No, Delete it| Delete([Trash Bin])
22-
A --> |No, Incubate it| Defer([Someday or Maybe])
23-
A --> |No, Reference it| Reference([Do it JIT or Someday])
24-
25-
B --> |No, Defer it| Plan([Plan Project List])
26-
B --> |Yes| C(Less than 2 minutes?)
27-
28-
C --> |No| D(For me?)
29-
C --> |Yes, Do it JIT| Do([Next Actions List])
30-
31-
D --> |No, Delegate it| Wait([Waiting for List])
32-
D --> |Yes| E(Specific day / time?)
33-
34-
E --> |No, Context it| Context(["@Context" List])
35-
E --> |Yes, Mark it| Calendar([Calendar])
36-
37-
style Delete fill:#d10,color:#fff
38-
style Defer fill:#d10,color:#fff
39-
style Reference fill:#d10,color:#fff
40-
style Plan fill:#f70,color:#fff
41-
style Wait fill:#f70,color:#fff
42-
style Context fill:#f70,color:#fff
43-
style Do fill:#1d0,color:#fff
44-
style Calendar fill:#1d0,color:#fff
45-
46-
linkStyle 0,5,7,9,11 stroke-width:2px,fill:none,stroke:green;
47-
linkStyle 1,2,3,4,6,8,10 stroke-width:2px,fill:none,stroke:red;
48-
49-
%% class Wait,Plan,Defer,Reference,Do,Context,Calendar,Delete internal-link
50-
51-
```
52-
53-
17+
-
18+
```mermaid
19+
flowchart TD
20+
21+
A[Is it Actionable?] -->|Yes| B(Single Step to complete?)
22+
A --> |No, Delete it| Delete([Trash Bin])
23+
A --> |No, Incubate it| Defer([Someday or Maybe])
24+
A --> |No, Reference it| Reference([Do it JIT or Someday])
25+
26+
B --> |No, Defer it| Plan([Plan Project List])
27+
B --> |Yes| C(Less than 2 minutes?)
28+
29+
C --> |No| D(For me?)
30+
C --> |Yes, Do it JIT| Do([Next Actions List])
31+
32+
D --> |No, Delegate it| Wait([Waiting for List])
33+
D --> |Yes| E(Specific day / time?)
34+
35+
E --> |No, Context it| Context(["@Context" List])
36+
E --> |Yes, Mark it| Calendar([Calendar])
37+
38+
style Delete fill:#d10,color:#fff
39+
style Defer fill:#d10,color:#fff
40+
style Reference fill:#d10,color:#fff
41+
style Plan fill:#f70,color:#fff
42+
style Wait fill:#f70,color:#fff
43+
style Context fill:#f70,color:#fff
44+
style Do fill:#1d0,color:#fff
45+
style Calendar fill:#1d0,color:#fff
46+
47+
linkStyle 0,5,7,9,11 stroke-width:2px,fill:none,stroke:green;
48+
linkStyle 1,2,3,4,6,8,10 stroke-width:2px,fill:none,stroke:red;
49+
50+
%% class Wait,Plan,Defer,Reference,Do,Context,Calendar,Delete internal-link
51+
52+
```
Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,56 @@
11
---
2+
aliases:
23
description:
34
created: 2025-05-18
4-
modified: 2025-05-18
5+
modified: 2025-05-25
56
---
67

7-
```mermaid
8-
flowchart LR
9-
10-
paper[Papers] --> paper_type{type}
11-
book[Books] --> book_type{type}
12-
article[Articles] --> article_type{type}
13-
video[Videos] --> capture([Capture])
14-
idea[Ideas] --> capture
15-
16-
capture --> |move| l_note
17-
18-
paper_type --> |digital| rms([RMS: Zotero, Bookends])
19-
paper_type --> |scanned, pdf| ipad([Note: Flexcil])
20-
paper_type --> |physical| note([Read & Highlight])
21-
22-
rms --> |extract with plugin| rms_note[/create reference note in Obsidian with template/]
23-
24-
ipad --> |extract| l_note[/Create Zettel note in Obsidian/]
25-
26-
note --> |extract| l_note
27-
28-
book_type --> |scanned, pdf| ipad
29-
book_type --> |ebook platform| ebook([Ebook: kindle, millie])
30-
book_type --> |physical| note
31-
32-
ebook --> |extract| l_note
33-
34-
article_type --> |digital| bookmark([Bookmark: Pocket])
35-
article_type --> |physical| note
36-
37-
bookmark --> |extract| l_note
38-
39-
style idea fill:#aa7,color:#fff
40-
style article fill:#7aa,color:#fff
41-
style video fill:#a7a,color:#fff
42-
style paper fill:#7a7,color:#fff
43-
style book fill:#a77,color:#fff
44-
45-
style rms fill:#f70,color:#fff
46-
style ipad fill:#f70,color:#fff
47-
style ebook fill:#f70,color:#fff
48-
style note fill:#f70,color:#fff
49-
style bookmark fill:#f70,color:#fff
50-
style capture fill:#f70,color:#fff
51-
52-
style l_note fill:#3b3,color:#fff
53-
style rms_note fill:#3b3,color:#fff
54-
```
8+
-
9+
```mermaid
10+
flowchart LR
11+
12+
paper[Papers] --> paper_type{type}
13+
book[Books] --> book_type{type}
14+
article[Articles] --> article_type{type}
15+
video[Videos] --> capture([Capture])
16+
idea[Ideas] --> capture
17+
18+
capture --> |move| l_note
19+
20+
paper_type --> |digital| rms([RMS: Zotero, Bookends])
21+
paper_type --> |scanned, pdf| ipad([Note: Flexcil])
22+
paper_type --> |physical| note([Read & Highlight])
23+
24+
rms --> |extract with plugin| rms_note[/create reference note in Obsidian with template/]
25+
26+
ipad --> |extract| l_note[/Create Zettel note in Obsidian/]
27+
28+
note --> |extract| l_note
29+
30+
book_type --> |scanned, pdf| ipad
31+
book_type --> |ebook platform| ebook([Ebook: kindle, millie])
32+
book_type --> |physical| note
33+
34+
ebook --> |extract| l_note
35+
36+
article_type --> |digital| bookmark([Bookmark: Pocket])
37+
article_type --> |physical| note
38+
39+
bookmark --> |extract| l_note
40+
41+
style idea fill:#aa7,color:#fff
42+
style article fill:#7aa,color:#fff
43+
style video fill:#a7a,color:#fff
44+
style paper fill:#7a7,color:#fff
45+
style book fill:#a77,color:#fff
46+
47+
style rms fill:#f70,color:#fff
48+
style ipad fill:#f70,color:#fff
49+
style ebook fill:#f70,color:#fff
50+
style note fill:#f70,color:#fff
51+
style bookmark fill:#f70,color:#fff
52+
style capture fill:#f70,color:#fff
53+
54+
style l_note fill:#3b3,color:#fff
55+
style rms_note fill:#3b3,color:#fff
56+
```

quartz/components/MarkmapViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function replaceMatches(str: string, regex: RegExp, replacer: (match: RegExpExec
2828
return accumulator
2929
}
3030

31-
const wikilinkRegex = /(!)?\[\[(?<link>[^|\]]+)\|?(?<displayText>[^\]]*)\]\]|#(?<tag>[A-Za-z0-9_-]+)(?=\s|$)/g
31+
const wikilinkRegex = /(!)?\[\[(?<link>[^|\]]+)\|?(?<displayText>[^\]]*)\]\]|(?<!:)#(?<tag>[A-Za-z0-9_-]+)(?=\s|$)/g
3232

3333
function replacement(currentPath: FullSlug) {
3434
return (match: RegExpExecArray) => {

quartz/components/scripts/markmap.inline.ts

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function renderGlobalMarkmap() {
111111
document.dispatchEvent(escEvent);
112112
});
113113

114+
renderMermaidInMarkmap(svg)
114115
}
115116

116117
function hideGlobalMarkmap() {
@@ -129,7 +130,6 @@ function toggleGlobalMarkmap() {
129130

130131
function setupMarkmapPopoverSupport() {
131132
const markmapLinks = document.querySelectorAll(".markmap .markmap-foreign a.internal") as NodeListOf<HTMLAnchorElement>
132-
console.log("markmap links", markmapLinks)
133133
for (const link of markmapLinks) {
134134
if (link.dataset.noPopover === "true") continue
135135

@@ -142,6 +142,59 @@ function setupMarkmapPopoverSupport() {
142142
}
143143
}
144144

145+
function renderMermaidInMarkmap(svg: SVGSVGElement) {
146+
requestAnimationFrame(async () => {
147+
const codeBlocks = svg.querySelectorAll("foreignObject code.language-mermaid")
148+
149+
if (codeBlocks.length === 0) return
150+
151+
const { default: mermaid } = await import(
152+
"https://cdnjs.cloudflare.com/ajax/libs/mermaid/11.4.0/mermaid.esm.min.mjs"
153+
)
154+
155+
mermaid.initialize({
156+
startOnLoad: false,
157+
theme: document.documentElement.getAttribute("saved-theme") === "dark" ? "dark" : "base",
158+
securityLevel: "loose",
159+
})
160+
161+
for (const code of codeBlocks) {
162+
const graph = code.textContent?.trim()
163+
if (!graph) continue
164+
165+
const pre = code.closest("pre")
166+
const div = code.closest("div")
167+
if (!div || !pre) continue
168+
169+
pre.remove()
170+
171+
const tempDiv = document.createElement("div")
172+
tempDiv.style.visibility = "hidden"
173+
tempDiv.style.position = "absolute"
174+
tempDiv.style.top = "-9999px"
175+
document.body.appendChild(tempDiv)
176+
177+
const mermaidDiv = document.createElement("div")
178+
mermaidDiv.className = "mermaid"
179+
mermaidDiv.textContent = graph
180+
tempDiv.appendChild(mermaidDiv)
181+
182+
try {
183+
await mermaid.run({ nodes: [mermaidDiv] })
184+
const renderedSvg = mermaidDiv.querySelector("svg")
185+
if (!renderedSvg) continue
186+
187+
const importedSvg = renderedSvg.cloneNode(true) as SVGSVGElement
188+
div.appendChild(importedSvg)
189+
190+
tempDiv.remove()
191+
} catch (err) {
192+
console.error("❌ Mermaid render failed:", err)
193+
}
194+
}
195+
})
196+
}
197+
145198
window.addEventListener("DOMContentLoaded", () => {
146199
const btn = document.getElementById("show-markmap")
147200
if (btn) {

quartz/components/scripts/popover.inline.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,64 @@
11
import { computePosition, flip, inline, shift } from "@floating-ui/dom"
22
import { normalizeRelativeURLs } from "../../util/path"
33
import { fetchCanonical } from "./util"
4+
import mermaidStyle from "../../components/styles/mermaid.inline.scss"
45

56
const p = new DOMParser()
67
let activeAnchor: HTMLAnchorElement | null = null
78

9+
async function renderMermaidInPopovers() {
10+
requestAnimationFrame(async () => {
11+
const codeBlocks = document.querySelectorAll(".popover .popover-inner code.mermaid")
12+
13+
if (codeBlocks.length === 0) return
14+
15+
const { default: mermaid } = await import(
16+
"https://cdnjs.cloudflare.com/ajax/libs/mermaid/11.4.0/mermaid.esm.min.mjs"
17+
)
18+
19+
mermaid.initialize({
20+
startOnLoad: false,
21+
theme: document.documentElement.getAttribute("saved-theme") === "dark" ? "dark" : "base",
22+
securityLevel: "loose",
23+
})
24+
25+
for (const code of codeBlocks) {
26+
const graph = code.textContent?.trim()
27+
if (!graph) continue
28+
29+
const container = document.createElement("div")
30+
container.className = "mermaid"
31+
container.textContent = graph
32+
33+
container.style.visibility = "hidden"
34+
container.style.position = "absolute"
35+
container.style.top = "-9999px"
36+
document.body.appendChild(container)
37+
38+
try {
39+
await mermaid.run({ nodes: [container] })
40+
} catch (err) {
41+
console.error("Mermaid render failed:", err)
42+
container.remove()
43+
continue
44+
}
45+
46+
const svgEl = container.querySelector("svg")
47+
if (!svgEl) {
48+
container.remove()
49+
continue
50+
}
51+
52+
const rendered = svgEl.cloneNode(true) as SVGSVGElement
53+
const parent = code.parentElement
54+
code.remove()
55+
parent?.appendChild(rendered)
56+
57+
container.remove()
58+
}
59+
})
60+
}
61+
862
async function mouseEnterHandler(
963
this: HTMLAnchorElement,
1064
{ clientX, clientY }: { clientX: number; clientY: number },
@@ -37,6 +91,8 @@ async function mouseEnterHandler(
3791
popoverInner.scroll({ top: heading.offsetTop - 12, behavior: "instant" })
3892
}
3993
}
94+
95+
renderMermaidInPopovers();
4096
}
4197

4298
const targetUrl = new URL(link.href)

quartz/plugins/transformers/markmap.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { QuartzTransformerPlugin } from "../types"
22
import { Transformer } from "markmap-lib"
3+
import mermaidStyle from "../../components/styles/mermaid.inline.scss"
4+
import { JSResource, CSSResource } from "../../util/resources"
35

46
export const MarkmapTransformer: QuartzTransformerPlugin = () => {
57

@@ -15,6 +17,16 @@ export const MarkmapTransformer: QuartzTransformerPlugin = () => {
1517
file.data.markmap = transformer.transform(String(file.value)).root
1618
}
1719
}]
18-
}
20+
},
21+
externalResources() {
22+
const js: JSResource[] = []
23+
const css: CSSResource[] = []
24+
css.push({
25+
content: mermaidStyle,
26+
inline: true,
27+
})
28+
29+
return { js, css }
30+
},
1931
}
2032
}

0 commit comments

Comments
 (0)