daftari 3.3.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +34 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/search/contested.d.ts +1 -1
- package/dist/search/contested.d.ts.map +1 -1
- package/dist/search/contested.js +4 -3
- package/dist/search/contested.js.map +1 -1
- package/dist/tools/backlinks.d.ts +6 -0
- package/dist/tools/backlinks.d.ts.map +1 -1
- package/dist/tools/backlinks.js +55 -1
- package/dist/tools/backlinks.js.map +1 -1
- package/dist/view/doc-view.d.ts +21 -0
- package/dist/view/doc-view.d.ts.map +1 -0
- package/dist/view/doc-view.js +53 -0
- package/dist/view/doc-view.js.map +1 -0
- package/dist/view/graph.d.ts +52 -0
- package/dist/view/graph.d.ts.map +1 -0
- package/dist/view/graph.js +133 -0
- package/dist/view/graph.js.map +1 -0
- package/dist/view/index.d.ts +3 -0
- package/dist/view/index.d.ts.map +1 -0
- package/dist/view/index.js +70 -0
- package/dist/view/index.js.map +1 -0
- package/dist/view/pages.d.ts +63 -0
- package/dist/view/pages.d.ts.map +1 -0
- package/dist/view/pages.js +478 -0
- package/dist/view/pages.js.map +1 -0
- package/dist/view/render.d.ts +15 -0
- package/dist/view/render.d.ts.map +1 -0
- package/dist/view/render.js +117 -0
- package/dist/view/render.js.map +1 -0
- package/dist/view/server.d.ts +16 -0
- package/dist/view/server.d.ts.map +1 -0
- package/dist/view/server.js +302 -0
- package/dist/view/server.js.map +1 -0
- package/dist/view/status-view.d.ts +32 -0
- package/dist/view/status-view.d.ts.map +1 -0
- package/dist/view/status-view.js +39 -0
- package/dist/view/status-view.js.map +1 -0
- package/package.json +10 -4
- package/templates/view/cytoscape.min.js +31 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
// Pure HTML page builders for `daftari view`. No IO, no server state — each
|
|
2
|
+
// takes plain data and returns an HTML string, so the pages are unit-testable
|
|
3
|
+
// without a running server. Every interpolated value is escaped (escHtml) or
|
|
4
|
+
// pre-sanitized (renderMarkdown for the doc body).
|
|
5
|
+
//
|
|
6
|
+
// The visual system is epistemic-first: a document's STANDING (status,
|
|
7
|
+
// confidence, tier, decay, contested) is the loudest thing on the page — a
|
|
8
|
+
// colored instrument strip, not grey metadata — because that standing is what
|
|
9
|
+
// the vault knows and a plain reader cannot show. Semantic colors: green =
|
|
10
|
+
// strong (high / canonical / fresh), amber = caution (medium / aging), red =
|
|
11
|
+
// weak/hazard (low / warn / deprecated), maroon accent = contested.
|
|
12
|
+
import { escHtml } from "./render.js";
|
|
13
|
+
const CSS = `
|
|
14
|
+
:root { color-scheme: light dark;
|
|
15
|
+
--bg:#f6f3ee; --surface:#fff; --surface-2:#faf8f4; --border:#e2ddd4; --border-2:#d0cabd;
|
|
16
|
+
--text:#20211f; --muted:#6b6b6b; --accent:#b11f4b; --accent-soft:rgba(177,31,75,.08);
|
|
17
|
+
--link:#0a66c2; --mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace;
|
|
18
|
+
--good:#15803d; --good-bg:rgba(21,128,61,.10);
|
|
19
|
+
--warn:#b45309; --warn-bg:rgba(180,83,9,.10);
|
|
20
|
+
--bad:#c2410c; --bad-bg:rgba(194,65,12,.10);
|
|
21
|
+
--dim:#8a8a8a; --dim-bg:rgba(138,138,138,.12); }
|
|
22
|
+
@media (prefers-color-scheme: dark) { :root {
|
|
23
|
+
--bg:#232322; --surface:#2c2c2b; --surface-2:#313130; --border:#42423f; --border-2:#565652;
|
|
24
|
+
--text:#e6e3dc; --muted:#9a988f; --accent:#fd8ea1; --accent-soft:rgba(253,142,161,.12);
|
|
25
|
+
--link:#69b3ff;
|
|
26
|
+
--good:#4ade80; --good-bg:rgba(74,222,128,.14);
|
|
27
|
+
--warn:#fbbf24; --warn-bg:rgba(251,191,36,.14);
|
|
28
|
+
--bad:#fb923c; --bad-bg:rgba(251,146,60,.14);
|
|
29
|
+
--dim:#8f8d86; --dim-bg:rgba(143,141,134,.16); } }
|
|
30
|
+
* { box-sizing:border-box; }
|
|
31
|
+
body { margin:0; background:var(--bg); color:var(--text);
|
|
32
|
+
font-family:-apple-system,"Segoe UI",Roboto,sans-serif; line-height:1.55; }
|
|
33
|
+
.wrap { max-width:920px; margin:0 auto; padding:20px 22px 90px; }
|
|
34
|
+
a { color:var(--link); text-decoration:none; } a:hover { text-decoration:underline; }
|
|
35
|
+
h1 { line-height:1.2; font-size:26px; margin:10px 0 14px; letter-spacing:-.01em; }
|
|
36
|
+
h2 { line-height:1.25; }
|
|
37
|
+
|
|
38
|
+
/* top bar */
|
|
39
|
+
.topbar { display:flex; align-items:center; gap:16px; margin:0 0 20px;
|
|
40
|
+
padding-bottom:12px; border-bottom:1px solid var(--border); }
|
|
41
|
+
.brand { font-weight:800; color:var(--accent); font-size:14px; letter-spacing:.02em;
|
|
42
|
+
font-family:var(--mono); }
|
|
43
|
+
.topbar form { margin-left:auto; }
|
|
44
|
+
.topbar input { font-size:13px; padding:6px 11px; border:1px solid var(--border-2);
|
|
45
|
+
border-radius:8px; background:var(--surface); color:var(--text); width:240px; }
|
|
46
|
+
|
|
47
|
+
/* standing strip — the epistemic hero */
|
|
48
|
+
.standing { display:flex; flex-wrap:wrap; align-items:center; gap:10px 12px;
|
|
49
|
+
background:var(--surface); border:1px solid var(--border); border-radius:12px;
|
|
50
|
+
padding:12px 16px; margin:0 0 16px; }
|
|
51
|
+
.badge { font-family:var(--mono); font-size:11px; font-weight:700; letter-spacing:.03em;
|
|
52
|
+
text-transform:uppercase; padding:3px 9px; border-radius:6px; border:1px solid transparent; }
|
|
53
|
+
.badge.solid-good { background:var(--good-bg); color:var(--good); border-color:var(--good); }
|
|
54
|
+
.badge.out-dim { color:var(--dim); border-color:var(--border-2); }
|
|
55
|
+
.badge.solid-bad { background:var(--bad-bg); color:var(--bad); border-color:var(--bad); }
|
|
56
|
+
.meter { display:inline-flex; align-items:center; gap:7px; }
|
|
57
|
+
.meter .label { font-family:var(--mono); font-size:10px; text-transform:uppercase;
|
|
58
|
+
letter-spacing:.05em; color:var(--muted); }
|
|
59
|
+
.meter .bars { display:inline-flex; gap:3px; }
|
|
60
|
+
.meter .seg { width:16px; height:7px; border-radius:2px; background:var(--dim-bg); }
|
|
61
|
+
.meter .seg.on-good { background:var(--good); } .meter .seg.on-warn { background:var(--warn); }
|
|
62
|
+
.meter .seg.on-bad { background:var(--bad); }
|
|
63
|
+
.chip { font-family:var(--mono); font-size:11px; padding:3px 9px; border-radius:6px;
|
|
64
|
+
display:inline-flex; align-items:center; gap:5px; }
|
|
65
|
+
.chip.good { background:var(--good-bg); color:var(--good); }
|
|
66
|
+
.chip.warn { background:var(--warn-bg); color:var(--warn); }
|
|
67
|
+
.chip.bad { background:var(--bad-bg); color:var(--bad); }
|
|
68
|
+
.chip.dim { background:var(--dim-bg); color:var(--muted); }
|
|
69
|
+
.chip.contested { background:var(--accent-soft); color:var(--accent); font-weight:700; }
|
|
70
|
+
.dot { width:8px; height:8px; border-radius:50%; display:inline-block; flex:0 0 auto; }
|
|
71
|
+
.dot.good{background:var(--good);} .dot.warn{background:var(--warn);}
|
|
72
|
+
.dot.bad{background:var(--bad);} .dot.dim{background:var(--dim);}
|
|
73
|
+
.spacer { flex:1 1 auto; }
|
|
74
|
+
.tier { font-family:var(--mono); font-size:11px; color:var(--muted); }
|
|
75
|
+
.graphlink { margin:0 0 14px; font-size:13px; }
|
|
76
|
+
.toc { background:var(--surface-2); border:1px solid var(--border); border-radius:10px;
|
|
77
|
+
padding:10px 16px; margin:0 0 16px; }
|
|
78
|
+
.toc h2 { font-size:11px; font-family:var(--mono); text-transform:uppercase; letter-spacing:.04em;
|
|
79
|
+
color:var(--muted); margin:0 0 6px; }
|
|
80
|
+
.toc ul { list-style:none; margin:0; padding:0; }
|
|
81
|
+
.toc li { padding:2px 0; font-size:13px; }
|
|
82
|
+
.toc li.d2 { padding-left:14px; } .toc li.d3 { padding-left:28px; font-size:12px; }
|
|
83
|
+
.body :is(h1,h2,h3) { scroll-margin-top:12px; }
|
|
84
|
+
.tags { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 16px; }
|
|
85
|
+
.tag { font-family:var(--mono); font-size:11px; color:var(--muted);
|
|
86
|
+
border:1px solid var(--border); border-radius:20px; padding:1px 9px; }
|
|
87
|
+
|
|
88
|
+
/* epistemic banners — differentiated by kind */
|
|
89
|
+
.banner { display:flex; gap:10px; align-items:flex-start; border-radius:10px;
|
|
90
|
+
padding:10px 14px; margin:0 0 10px; font-size:13px; border:1px solid var(--border);
|
|
91
|
+
border-left-width:4px; background:var(--surface-2); }
|
|
92
|
+
.banner .bk { font-family:var(--mono); font-size:10px; font-weight:700; letter-spacing:.05em;
|
|
93
|
+
text-transform:uppercase; padding-top:2px; flex:0 0 auto; }
|
|
94
|
+
.banner.bad { border-left-color:var(--bad); } .banner.bad .bk { color:var(--bad); }
|
|
95
|
+
.banner.warn { border-left-color:var(--warn);} .banner.warn .bk { color:var(--warn); }
|
|
96
|
+
|
|
97
|
+
/* contested panel */
|
|
98
|
+
.tensions { border:1px solid var(--accent); border-left-width:4px; border-radius:10px;
|
|
99
|
+
padding:12px 16px; margin:0 0 16px; background:var(--accent-soft); }
|
|
100
|
+
.tensions h2 { font-size:13px; color:var(--accent); margin:0 0 8px; font-family:var(--mono);
|
|
101
|
+
text-transform:uppercase; letter-spacing:.04em; }
|
|
102
|
+
.tensions ul { list-style:none; margin:0; padding:0; }
|
|
103
|
+
.tensions li { padding:8px 0; border-top:1px solid var(--border); font-size:13px; }
|
|
104
|
+
.tensions li:first-child { border-top:none; }
|
|
105
|
+
.tensions .claim { color:var(--muted); margin-top:3px; }
|
|
106
|
+
.tensions .k { font-family:var(--mono); font-size:11px; }
|
|
107
|
+
|
|
108
|
+
/* body */
|
|
109
|
+
.body { background:var(--surface); border:1px solid var(--border); border-radius:12px;
|
|
110
|
+
padding:22px 26px; overflow-wrap:anywhere; }
|
|
111
|
+
.body h1,.body h2,.body h3 { margin-top:1.4em; }
|
|
112
|
+
.body pre { background:#1c1c1c; color:#e2e2e2; padding:12px 14px; border-radius:8px; overflow:auto; }
|
|
113
|
+
.body code { background:var(--dim-bg); padding:1px 5px; border-radius:4px; font-size:.92em; }
|
|
114
|
+
.body pre code { background:none; padding:0; }
|
|
115
|
+
.body blockquote { border-left:3px solid var(--border-2); margin:0; padding-left:14px; color:var(--muted); }
|
|
116
|
+
|
|
117
|
+
/* backlinks */
|
|
118
|
+
.backlinks { margin-top:22px; }
|
|
119
|
+
.backlinks h2 { font-size:12px; color:var(--muted); font-family:var(--mono);
|
|
120
|
+
text-transform:uppercase; letter-spacing:.04em; }
|
|
121
|
+
.backlinks ul { list-style:none; margin:0; padding:0; }
|
|
122
|
+
.backlinks li { padding:5px 0; font-size:13px; display:flex; gap:8px; align-items:center; }
|
|
123
|
+
|
|
124
|
+
/* index — a knowledge map, not a link wall */
|
|
125
|
+
.collection { margin:26px 0 4px; font-size:11px; letter-spacing:.06em; font-family:var(--mono);
|
|
126
|
+
text-transform:uppercase; color:var(--muted); }
|
|
127
|
+
ul.docs { list-style:none; margin:0; padding:0; }
|
|
128
|
+
ul.docs li { display:flex; align-items:center; gap:10px; padding:7px 4px;
|
|
129
|
+
border-bottom:1px solid var(--border); }
|
|
130
|
+
ul.docs .std { display:inline-flex; align-items:center; gap:5px; flex:0 0 auto; width:74px; }
|
|
131
|
+
ul.docs .title { flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
132
|
+
ul.docs .cf { font-family:var(--mono); font-size:10px; color:var(--muted); flex:0 0 auto; }
|
|
133
|
+
|
|
134
|
+
/* search results */
|
|
135
|
+
.results { list-style:none; margin:0; padding:0; }
|
|
136
|
+
.results li { padding:12px 0; border-bottom:1px solid var(--border); }
|
|
137
|
+
.results .snippet { color:var(--muted); font-size:13px; margin-top:3px; }
|
|
138
|
+
.results .meta { font-family:var(--mono); font-size:10px; color:var(--muted);
|
|
139
|
+
text-transform:uppercase; letter-spacing:.04em; }
|
|
140
|
+
.empty { color:var(--muted); font-size:13px; }
|
|
141
|
+
|
|
142
|
+
/* graph */
|
|
143
|
+
.gtools { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin:0 0 8px; font-size:13px; }
|
|
144
|
+
.gtools label { font-family:var(--mono); font-size:11px; color:var(--muted); }
|
|
145
|
+
.gtools select { font-size:13px; padding:4px 8px; border:1px solid var(--border-2);
|
|
146
|
+
border-radius:7px; background:var(--surface); color:var(--text); }
|
|
147
|
+
.ginfo { font-size:12px; color:var(--muted); margin:0 0 8px; min-height:15px; }
|
|
148
|
+
#cy { width:100%; height:72vh; background:var(--surface); border:1px solid var(--border);
|
|
149
|
+
border-radius:12px; }
|
|
150
|
+
.legend { display:flex; gap:16px; flex-wrap:wrap; font-family:var(--mono); font-size:11px;
|
|
151
|
+
color:var(--muted); margin:10px 0 0; }
|
|
152
|
+
.legend .sw { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:5px;
|
|
153
|
+
vertical-align:middle; }
|
|
154
|
+
.legend .ln { display:inline-block; width:16px; height:0; border-top:3px solid; margin-right:5px;
|
|
155
|
+
vertical-align:middle; }
|
|
156
|
+
|
|
157
|
+
/* topbar nav */
|
|
158
|
+
.nav { display:flex; gap:14px; margin-left:18px; }
|
|
159
|
+
.nav a { font-family:var(--mono); font-size:12px; color:var(--muted); }
|
|
160
|
+
.nav a:hover { color:var(--link); }
|
|
161
|
+
|
|
162
|
+
/* dashboard */
|
|
163
|
+
.tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin:0 0 20px; }
|
|
164
|
+
.tile { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 16px; }
|
|
165
|
+
.tile .num { font-size:28px; font-weight:700; letter-spacing:-.02em; }
|
|
166
|
+
.tile .lbl { font-family:var(--mono); font-size:11px; text-transform:uppercase; letter-spacing:.04em;
|
|
167
|
+
color:var(--muted); margin-top:2px; }
|
|
168
|
+
.tile a { display:block; }
|
|
169
|
+
.tile.alert .num { color:var(--accent); }
|
|
170
|
+
.panel { background:var(--surface); border:1px solid var(--border); border-radius:12px;
|
|
171
|
+
padding:14px 18px; margin:0 0 16px; }
|
|
172
|
+
.panel h2 { font-size:12px; font-family:var(--mono); text-transform:uppercase; letter-spacing:.04em;
|
|
173
|
+
color:var(--muted); margin:0 0 10px; }
|
|
174
|
+
.sbar { display:flex; height:14px; border-radius:7px; overflow:hidden; background:var(--dim-bg); }
|
|
175
|
+
.sbar span { display:block; }
|
|
176
|
+
.sbar .fresh { background:var(--good); } .sbar .aging { background:var(--warn); }
|
|
177
|
+
.sbar .stale { background:var(--bad); }
|
|
178
|
+
.sbar-key { display:flex; gap:16px; margin-top:8px; font-family:var(--mono); font-size:11px; color:var(--muted); }
|
|
179
|
+
.sbar-key .sw { display:inline-block; width:9px; height:9px; border-radius:2px; margin-right:5px; vertical-align:middle; }
|
|
180
|
+
.runs { list-style:none; margin:0; padding:0; }
|
|
181
|
+
.runs li { display:flex; gap:10px; align-items:baseline; padding:5px 0; border-top:1px solid var(--border); font-size:13px; }
|
|
182
|
+
.runs li:first-child { border-top:none; }
|
|
183
|
+
.runs .kind { font-family:var(--mono); font-size:11px; color:var(--muted); min-width:96px; }
|
|
184
|
+
.runs .when { color:var(--muted); font-size:12px; }
|
|
185
|
+
`;
|
|
186
|
+
function searchBox(query = "") {
|
|
187
|
+
return `<form class="search" action="/search" method="get">
|
|
188
|
+
<input type="search" name="q" placeholder="Search the vault…" value="${escHtml(query)}" autocomplete="off"></form>`;
|
|
189
|
+
}
|
|
190
|
+
export function layout(title, bodyHtml, query = "") {
|
|
191
|
+
return (`<!doctype html><html><head><meta charset="utf-8">
|
|
192
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
193
|
+
<title>${escHtml(title)}</title><style>${CSS}</style></head>
|
|
194
|
+
<body><div class="wrap"><div class="topbar"><a class="brand" href="/">daftari · vault</a>` +
|
|
195
|
+
`<nav class="nav"><a href="/docs">documents</a><a href="/graph">graph</a></nav>` +
|
|
196
|
+
`${searchBox(query)}</div>${bodyHtml}</div></body></html>`);
|
|
197
|
+
}
|
|
198
|
+
// --- epistemic visual vocabulary ---------------------------------------------
|
|
199
|
+
// Confidence → a 3-segment meter (low=1 red, medium=2 amber, high=3 green).
|
|
200
|
+
function confidenceMeter(conf) {
|
|
201
|
+
const rank = conf === "high" ? 3 : conf === "medium" ? 2 : 1;
|
|
202
|
+
const tone = conf === "high" ? "good" : conf === "medium" ? "warn" : "bad";
|
|
203
|
+
const segs = [1, 2, 3]
|
|
204
|
+
.map((i) => `<span class="seg${i <= rank ? ` on-${tone}` : ""}"></span>`)
|
|
205
|
+
.join("");
|
|
206
|
+
return `<span class="meter" title="confidence: ${escHtml(conf)}"><span class="label">conf</span><span class="bars">${segs}</span></span>`;
|
|
207
|
+
}
|
|
208
|
+
// Status → a badge: canonical is solid-strong, draft is an outline, a retired
|
|
209
|
+
// state (deprecated/superseded/archived) is solid-bad.
|
|
210
|
+
function statusBadge(status) {
|
|
211
|
+
const cls = status === "canonical" ? "solid-good" : status === "draft" ? "out-dim" : "solid-bad";
|
|
212
|
+
return `<span class="badge ${cls}">${escHtml(status)}</span>`;
|
|
213
|
+
}
|
|
214
|
+
function tierTag(tier) {
|
|
215
|
+
return `<span class="tier">tier: ${escHtml(tier ?? "—")}</span>`;
|
|
216
|
+
}
|
|
217
|
+
// Decay level → a colored chip. Null = fresh, rendered as a quiet good chip so
|
|
218
|
+
// the healthy state is legible too (not merely the absence of a warning).
|
|
219
|
+
function decayChip(level) {
|
|
220
|
+
if (level === null)
|
|
221
|
+
return `<span class="chip good"><span class="dot good"></span>fresh</span>`;
|
|
222
|
+
const tone = level === "aging" ? "warn" : "bad";
|
|
223
|
+
return `<span class="chip ${tone}"><span class="dot ${tone}"></span>${escHtml(level)}</span>`;
|
|
224
|
+
}
|
|
225
|
+
const BANNER_META = {
|
|
226
|
+
decay: { label: "decay", tone: "bad" },
|
|
227
|
+
structural: { label: "structure", tone: "warn" },
|
|
228
|
+
upstream: { label: "upstream", tone: "warn" },
|
|
229
|
+
anchor: { label: "pins", tone: "bad" },
|
|
230
|
+
validity: { label: "validity", tone: "bad" },
|
|
231
|
+
};
|
|
232
|
+
export function renderDocPage(args) {
|
|
233
|
+
const fm = args.frontmatter;
|
|
234
|
+
const contested = args.contestedCount ?? args.tensions?.length ?? 0;
|
|
235
|
+
const standing = `<div class="standing">` +
|
|
236
|
+
statusBadge(fm.status) +
|
|
237
|
+
confidenceMeter(fm.confidence) +
|
|
238
|
+
decayChip(args.decayLevel ?? null) +
|
|
239
|
+
(contested > 0 ? `<span class="chip contested">⚔ contested×${contested}</span>` : "") +
|
|
240
|
+
(args.validity ? `<span class="chip dim">valid ${escHtml(args.validity)}</span>` : "") +
|
|
241
|
+
`<span class="spacer"></span>` +
|
|
242
|
+
`<span class="chip dim">${escHtml(fm.provenance)}</span>` +
|
|
243
|
+
tierTag(fm.tier) +
|
|
244
|
+
`</div>`;
|
|
245
|
+
const tags = fm.tags.length > 0
|
|
246
|
+
? `<div class="tags">${fm.tags.map((t) => `<span class="tag">${escHtml(t)}</span>`).join("")}</div>`
|
|
247
|
+
: "";
|
|
248
|
+
const banners = (args.banners ?? [])
|
|
249
|
+
.map((b) => {
|
|
250
|
+
const m = BANNER_META[b.kind];
|
|
251
|
+
return `<div class="banner ${m.tone}"><span class="bk">${escHtml(m.label)}</span><span>${escHtml(b.text)}</span></div>`;
|
|
252
|
+
})
|
|
253
|
+
.join("");
|
|
254
|
+
const tensions = args.tensions ?? [];
|
|
255
|
+
const tensionsPanel = tensions.length === 0
|
|
256
|
+
? ""
|
|
257
|
+
: `<div class="tensions"><h2>⚔ Contested</h2><ul>${tensions
|
|
258
|
+
.map((t) => `<li><span class="chip contested">${escHtml(t.kind)}</span> vs ` +
|
|
259
|
+
`<a href="/doc/${encodeURI(t.counterpart)}">${escHtml(t.counterpart)}</a>` +
|
|
260
|
+
`<div class="claim"><span class="k">this</span> — ${escHtml(t.claimSelf)}</div>` +
|
|
261
|
+
`<div class="claim"><span class="k">other</span> — ${escHtml(t.claimOther)}</div></li>`)
|
|
262
|
+
.join("")}</ul></div>`;
|
|
263
|
+
const backlinks = args.backlinks.length === 0
|
|
264
|
+
? `<p class="empty">No documents reference this one.</p>`
|
|
265
|
+
: `<ul>${args.backlinks
|
|
266
|
+
.map((b) => `<li><a href="/doc/${encodeURI(b.doc)}">${escHtml(b.doc)}</a> <span class="tag">${escHtml(b.label)}</span></li>`)
|
|
267
|
+
.join("")}</ul>`;
|
|
268
|
+
// R7: walk this document's neighborhood in the knowledge graph.
|
|
269
|
+
const graphLink = `<div class="graphlink"><a href="/graph?scope=ego&root=${encodeURI(args.path)}&depth=2">` +
|
|
270
|
+
`◧ neighborhood graph →</a></div>`;
|
|
271
|
+
// R11: a table of contents, shown only when the body has enough structure to
|
|
272
|
+
// warrant one. Headings carry matching ids (added by renderDocBody).
|
|
273
|
+
const toc = args.toc ?? [];
|
|
274
|
+
const tocPanel = toc.length >= 3
|
|
275
|
+
? `<nav class="toc"><h2>On this page</h2><ul>${toc
|
|
276
|
+
.map((t) => `<li class="d${t.depth}"><a href="#${encodeURI(t.id)}">${escHtml(t.text)}</a></li>`)
|
|
277
|
+
.join("")}</ul></nav>`
|
|
278
|
+
: "";
|
|
279
|
+
const body = `<h1>${escHtml(fm.title || args.path)}</h1>` +
|
|
280
|
+
standing +
|
|
281
|
+
graphLink +
|
|
282
|
+
tags +
|
|
283
|
+
banners +
|
|
284
|
+
tensionsPanel +
|
|
285
|
+
tocPanel +
|
|
286
|
+
`<div class="body">${args.bodyHtml}</div>` +
|
|
287
|
+
`<div class="backlinks"><h2>Backlinks</h2>${backlinks}</div>`;
|
|
288
|
+
return layout(fm.title || args.path, body);
|
|
289
|
+
}
|
|
290
|
+
// A per-row standing glance: a status dot + a confidence dot, so a reader
|
|
291
|
+
// scans standing down the column instead of reading a wall of identical links.
|
|
292
|
+
function statusDot(status) {
|
|
293
|
+
const tone = status === "canonical" ? "good" : status === "draft" ? "dim" : status ? "bad" : "dim";
|
|
294
|
+
return `<span class="dot ${tone}" title="status: ${escHtml(status ?? "—")}"></span>`;
|
|
295
|
+
}
|
|
296
|
+
function confidenceDot(conf) {
|
|
297
|
+
const tone = conf === "high" ? "good" : conf === "medium" ? "warn" : conf ? "bad" : "dim";
|
|
298
|
+
return `<span class="dot ${tone}" title="confidence: ${escHtml(conf ?? "—")}"></span>`;
|
|
299
|
+
}
|
|
300
|
+
export function renderIndexPage(groups) {
|
|
301
|
+
if (groups.length === 0) {
|
|
302
|
+
return layout("Vault", `<h1>Vault</h1><p class="empty">No documents found.</p>`);
|
|
303
|
+
}
|
|
304
|
+
const sections = groups
|
|
305
|
+
.map((g) => {
|
|
306
|
+
const items = g.docs
|
|
307
|
+
.map((d) => `<li><span class="std">${statusDot(d.status)}${confidenceDot(d.confidence)}</span>` +
|
|
308
|
+
`<span class="title"><a href="/doc/${encodeURI(d.path)}">${escHtml(d.title || d.path)}</a></span>` +
|
|
309
|
+
`<span class="cf">${escHtml(d.status ?? "")}</span></li>`)
|
|
310
|
+
.join("");
|
|
311
|
+
return `<div class="collection">${escHtml(g.collection)}</div><ul class="docs">${items}</ul>`;
|
|
312
|
+
})
|
|
313
|
+
.join("");
|
|
314
|
+
return layout("Vault", `<h1>Vault</h1>${sections}`);
|
|
315
|
+
}
|
|
316
|
+
export function renderSearchPage(query, hits) {
|
|
317
|
+
const q = query.trim();
|
|
318
|
+
if (q.length === 0) {
|
|
319
|
+
return layout("Search", `<h1>Search</h1><p class="empty">Type a query above.</p>`);
|
|
320
|
+
}
|
|
321
|
+
const body = hits.length === 0
|
|
322
|
+
? `<h1>Search</h1><p class="empty">No results for “${escHtml(q)}”.</p>`
|
|
323
|
+
: `<h1>Search</h1><ul class="results">${hits
|
|
324
|
+
.map((h) => `<li><a href="/doc/${encodeURI(h.path)}">${escHtml(h.title || h.path)}</a>` +
|
|
325
|
+
`<div class="meta">${escHtml(h.collection)}</div>` +
|
|
326
|
+
`<div class="snippet">${escHtml(h.snippet)}</div></li>`)
|
|
327
|
+
.join("")}</ul>`;
|
|
328
|
+
return layout("Search", body, q);
|
|
329
|
+
}
|
|
330
|
+
// --- graph -------------------------------------------------------------------
|
|
331
|
+
// The graph client is fully static (no server data is interpolated): it reads
|
|
332
|
+
// the current query string and fetches /api/graph, so the same script serves
|
|
333
|
+
// whole-vault and ego views. Kept as vanilla JS — the one lazy-loaded library
|
|
334
|
+
// (cytoscape) is the only client dependency, and only on this route.
|
|
335
|
+
const GRAPH_CLIENT_JS = `
|
|
336
|
+
(function () {
|
|
337
|
+
var COL = { canonical:'#15803d', draft:'#8a8a8a', retired:'#c2410c',
|
|
338
|
+
contested:'#b11f4b', decayed:'#b45309', derives:'#0a66c2', edge:'#c9c1b4' };
|
|
339
|
+
var info = document.getElementById('ginfo');
|
|
340
|
+
fetch('/api/graph' + (location.search || '')).then(function (r) { return r.json(); }).then(function (g) {
|
|
341
|
+
if (!g.nodes || g.nodes.length === 0) { info.textContent = 'No documents to graph.'; return; }
|
|
342
|
+
if (g.truncated) {
|
|
343
|
+
info.textContent = 'Showing ' + g.shown + ' of ' + g.total + ' documents (most-connected shown).';
|
|
344
|
+
} else {
|
|
345
|
+
info.textContent = g.shown + ' documents, ' + g.edges.length + ' links.';
|
|
346
|
+
}
|
|
347
|
+
var els = [];
|
|
348
|
+
var statuses = {}, collections = {};
|
|
349
|
+
for (var i = 0; i < g.nodes.length; i++) {
|
|
350
|
+
var n = g.nodes[i];
|
|
351
|
+
statuses[n.status] = 1; collections[n.collection] = 1;
|
|
352
|
+
els.push({ data: { id: n.path, label: n.title || n.path, status: n.status,
|
|
353
|
+
decayed: !!n.decayed, contested: !!n.contested, collection: n.collection } });
|
|
354
|
+
}
|
|
355
|
+
for (var j = 0; j < g.edges.length; j++) {
|
|
356
|
+
var e = g.edges[j];
|
|
357
|
+
els.push({ data: { source: e.from, target: e.to, kind: e.kind } });
|
|
358
|
+
}
|
|
359
|
+
var cy = cytoscape({
|
|
360
|
+
container: document.getElementById('cy'),
|
|
361
|
+
elements: els,
|
|
362
|
+
style: [
|
|
363
|
+
{ selector: 'node', style: { 'label': 'data(label)', 'font-size': 7, 'width': 16, 'height': 16,
|
|
364
|
+
'background-color': COL.draft, 'color': '#6b6b6b', 'text-wrap': 'ellipsis', 'text-max-width': 90,
|
|
365
|
+
'text-valign': 'bottom', 'text-margin-y': 2, 'border-width': 0, 'min-zoomed-font-size': 6 } },
|
|
366
|
+
{ selector: 'node[status="canonical"]', style: { 'background-color': COL.canonical } },
|
|
367
|
+
{ selector: 'node[status="draft"]', style: { 'background-color': COL.draft } },
|
|
368
|
+
{ selector: 'node[status="deprecated"]', style: { 'background-color': COL.retired } },
|
|
369
|
+
{ selector: 'node[status="superseded"]', style: { 'background-color': COL.retired } },
|
|
370
|
+
{ selector: 'node[status="archived"]', style: { 'background-color': COL.retired } },
|
|
371
|
+
{ selector: 'node[?decayed]', style: { 'border-width': 3, 'border-color': COL.decayed, 'border-style': 'dashed' } },
|
|
372
|
+
{ selector: 'node[?contested]', style: { 'border-width': 4, 'border-color': COL.contested, 'border-style': 'solid' } },
|
|
373
|
+
{ selector: 'edge', style: { 'width': 1.2, 'line-color': COL.edge, 'curve-style': 'bezier',
|
|
374
|
+
'target-arrow-color': COL.edge, 'target-arrow-shape': 'triangle', 'arrow-scale': 0.7 } },
|
|
375
|
+
{ selector: 'edge[kind="derives_from"]', style: { 'line-color': COL.derives, 'target-arrow-color': COL.derives } },
|
|
376
|
+
{ selector: 'edge[kind="contested"]', style: { 'line-color': COL.contested, 'line-style': 'dashed', 'target-arrow-shape': 'none' } },
|
|
377
|
+
{ selector: '.hidden', style: { 'display': 'none' } }
|
|
378
|
+
],
|
|
379
|
+
layout: { name: 'cose', animate: false, padding: 24, nodeRepulsion: 7000, idealEdgeLength: 70 }
|
|
380
|
+
});
|
|
381
|
+
cy.on('tap', 'node', function (evt) { window.location.href = '/doc/' + encodeURI(evt.target.id()); });
|
|
382
|
+
|
|
383
|
+
function opts(sel, keys) {
|
|
384
|
+
var s = document.getElementById(sel);
|
|
385
|
+
Object.keys(keys).sort().forEach(function (k) {
|
|
386
|
+
var o = document.createElement('option'); o.value = k; o.textContent = k; s.appendChild(o);
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
opts('fstatus', statuses); opts('fcollection', collections);
|
|
390
|
+
function apply() {
|
|
391
|
+
var st = document.getElementById('fstatus').value;
|
|
392
|
+
var co = document.getElementById('fcollection').value;
|
|
393
|
+
cy.batch(function () {
|
|
394
|
+
cy.nodes().forEach(function (n) {
|
|
395
|
+
var hide = (st !== 'all' && n.data('status') !== st) || (co !== 'all' && n.data('collection') !== co);
|
|
396
|
+
if (hide) n.addClass('hidden'); else n.removeClass('hidden');
|
|
397
|
+
});
|
|
398
|
+
cy.edges().forEach(function (e) {
|
|
399
|
+
if (e.source().hasClass('hidden') || e.target().hasClass('hidden')) e.addClass('hidden');
|
|
400
|
+
else e.removeClass('hidden');
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
document.getElementById('fstatus').addEventListener('change', apply);
|
|
405
|
+
document.getElementById('fcollection').addEventListener('change', apply);
|
|
406
|
+
}).catch(function (err) { info.textContent = 'Failed to load graph: ' + err; });
|
|
407
|
+
})();
|
|
408
|
+
`;
|
|
409
|
+
export function renderGraphPage(opts) {
|
|
410
|
+
const scopeLabel = opts.scope === "ego" && opts.root
|
|
411
|
+
? `Neighborhood of <a href="/doc/${encodeURI(opts.root)}">${escHtml(opts.root)}</a>`
|
|
412
|
+
: "Whole vault";
|
|
413
|
+
const body = `<h1>Knowledge graph</h1>` +
|
|
414
|
+
`<div class="ginfo" id="ginfo">${scopeLabel} — loading…</div>` +
|
|
415
|
+
`<div class="gtools">` +
|
|
416
|
+
`<label for="fstatus">status</label><select id="fstatus"><option value="all">all</option></select>` +
|
|
417
|
+
`<label for="fcollection">collection</label><select id="fcollection"><option value="all">all</option></select>` +
|
|
418
|
+
(opts.scope === "ego" ? `<a href="/graph">↔ whole vault</a>` : "") +
|
|
419
|
+
`</div>` +
|
|
420
|
+
`<div id="cy"></div>` +
|
|
421
|
+
`<div class="legend">` +
|
|
422
|
+
`<span><span class="sw" style="background:#15803d"></span>canonical</span>` +
|
|
423
|
+
`<span><span class="sw" style="background:#8a8a8a"></span>draft</span>` +
|
|
424
|
+
`<span><span class="sw" style="background:#c2410c"></span>retired</span>` +
|
|
425
|
+
`<span><span class="sw" style="background:#fff;border:3px dashed #b45309"></span>decayed</span>` +
|
|
426
|
+
`<span><span class="sw" style="background:#fff;border:4px solid #b11f4b"></span>contested</span>` +
|
|
427
|
+
`<span><span class="ln" style="border-color:#0a66c2"></span>derives_from</span>` +
|
|
428
|
+
`<span><span class="ln" style="border-color:#b11f4b"></span>contested</span>` +
|
|
429
|
+
`</div>` +
|
|
430
|
+
`<script src="/assets/cytoscape.min.js"></script>` +
|
|
431
|
+
`<script>${GRAPH_CLIENT_JS}</script>`;
|
|
432
|
+
return layout("Knowledge graph", body);
|
|
433
|
+
}
|
|
434
|
+
// --- dashboard (home) --------------------------------------------------------
|
|
435
|
+
function tile(num, label, opts = {}) {
|
|
436
|
+
const inner = `<div class="num">${escHtml(String(num))}</div><div class="lbl">${escHtml(label)}</div>`;
|
|
437
|
+
const cls = `tile${opts.alert ? " alert" : ""}`;
|
|
438
|
+
return opts.href
|
|
439
|
+
? `<div class="${cls}"><a href="${opts.href}">${inner}</a></div>`
|
|
440
|
+
: `<div class="${cls}">${inner}</div>`;
|
|
441
|
+
}
|
|
442
|
+
export function renderDashboardPage(s) {
|
|
443
|
+
const tiles = `<div class="tiles">` +
|
|
444
|
+
tile(s.fileCount, "documents", { href: "/docs" }) +
|
|
445
|
+
tile(s.collections.length, "collections") +
|
|
446
|
+
tile(s.unresolvedTensions, "open tensions", { alert: s.unresolvedTensions > 0 }) +
|
|
447
|
+
tile(s.ratificationQueue, "ratification queue", { alert: s.ratificationQueue > 0 }) +
|
|
448
|
+
`</div>`;
|
|
449
|
+
// Staleness distribution as one proportional bar (fresh/aging/stale).
|
|
450
|
+
const st = s.staleness;
|
|
451
|
+
const pct = (n) => (st.total > 0 ? (n / st.total) * 100 : 0);
|
|
452
|
+
const stalenessPanel = `<div class="panel"><h2>Freshness</h2>` +
|
|
453
|
+
`<div class="sbar">` +
|
|
454
|
+
`<span class="fresh" style="width:${pct(st.fresh)}%"></span>` +
|
|
455
|
+
`<span class="aging" style="width:${pct(st.aging)}%"></span>` +
|
|
456
|
+
`<span class="stale" style="width:${pct(st.stale)}%"></span>` +
|
|
457
|
+
`</div>` +
|
|
458
|
+
`<div class="sbar-key">` +
|
|
459
|
+
`<span><span class="sw" style="background:var(--good)"></span>fresh ${st.fresh}</span>` +
|
|
460
|
+
`<span><span class="sw" style="background:var(--warn)"></span>aging ${st.aging}</span>` +
|
|
461
|
+
`<span><span class="sw" style="background:var(--bad)"></span>stale ${st.stale}</span>` +
|
|
462
|
+
`<span>valid-time ${s.validity.authored}/${s.validity.total}</span>` +
|
|
463
|
+
(s.invalidCount > 0 ? `<span>⚠ ${s.invalidCount} invalid</span>` : "") +
|
|
464
|
+
`</div></div>`;
|
|
465
|
+
const runsPanel = s.recentRuns.length === 0
|
|
466
|
+
? `<div class="panel"><h2>Recent sleep runs</h2><p class="empty">No runs recorded yet.</p></div>`
|
|
467
|
+
: `<div class="panel"><h2>Recent sleep runs</h2><ul class="runs">${s.recentRuns
|
|
468
|
+
.map((r) => `<li><span class="kind">${escHtml(r.kind)}</span>` +
|
|
469
|
+
`<span class="when">${escHtml(r.ts.slice(0, 16).replace("T", " "))}</span></li>`)
|
|
470
|
+
.join("")}</ul></div>`;
|
|
471
|
+
const body = `<h1>Vault dashboard</h1>` +
|
|
472
|
+
tiles +
|
|
473
|
+
stalenessPanel +
|
|
474
|
+
runsPanel +
|
|
475
|
+
`<div class="graphlink"><a href="/graph">◧ open the knowledge graph →</a></div>`;
|
|
476
|
+
return layout("Vault dashboard", body);
|
|
477
|
+
}
|
|
478
|
+
//# sourceMappingURL=pages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../../src/view/pages.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,mDAAmD;AACnD,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,2EAA2E;AAC3E,6EAA6E;AAC7E,oEAAoE;AAGpE,OAAO,EAAE,OAAO,EAAiB,MAAM,aAAa,CAAC;AAGrD,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4KX,CAAC;AAEF,SAAS,SAAS,CAAC,KAAK,GAAG,EAAE;IAC3B,OAAO;uEAC8D,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC;AACpH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,KAAa,EAAE,QAAgB,EAAE,KAAK,GAAG,EAAE;IAChE,OAAO,CACL;;SAEK,OAAO,CAAC,KAAK,CAAC,kBAAkB,GAAG;0FAC8C;QACtF,gFAAgF;QAChF,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,QAAQ,sBAAsB,CAC3D,CAAC;AACJ,CAAC;AAED,gFAAgF;AAEhF,4EAA4E;AAC5E,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,IAAI,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG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;QACvB,CAAC,CAAC,+FAA+F;QACjG,CAAC,CAAC,iEAAiE,CAAC,CAAC,UAAU;aAC1E,GAAG,CACF,CAAC,CAAC,EAAE,EAAE,CACJ,0BAA0B,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS;YAClD,sBAAsB,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,cAAc,CACnF;aACA,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;IAE/B,MAAM,IAAI,GACR,0BAA0B;QAC1B,KAAK;QACL,cAAc;QACd,SAAS;QACT,gFAAgF,CAAC;IACnF,OAAO,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function renderMarkdown(md: string): string;
|
|
2
|
+
export interface TocEntry {
|
|
3
|
+
depth: number;
|
|
4
|
+
text: string;
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function renderDocBody(md: string, opts?: {
|
|
8
|
+
resolveLink?: (rawTarget: string) => string | null;
|
|
9
|
+
}): {
|
|
10
|
+
html: string;
|
|
11
|
+
toc: TocEntry[];
|
|
12
|
+
};
|
|
13
|
+
export declare function escHtml(s: unknown): string;
|
|
14
|
+
export declare function jsonForScript(value: unknown): string;
|
|
15
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/view/render.ts"],"names":[],"mappings":"AAqBA,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEjD;AAGD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AA0CD,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;CAAO,GAChE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,EAAE,CAAA;CAAE,CA+CnC;AAGD,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAM1C;AAMD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKpD"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Server-side render helpers for `daftari view`. The markdown→HTML pipeline is
|
|
2
|
+
// the standard unified stack with rehype-sanitize, so untrusted document bodies
|
|
3
|
+
// cannot inject script or dangerous-protocol links into the viewer. Pure and
|
|
4
|
+
// synchronous (every plugin here is sync), so page builders can call it inline.
|
|
5
|
+
import rehypeSanitize from "rehype-sanitize";
|
|
6
|
+
import rehypeStringify from "rehype-stringify";
|
|
7
|
+
import remarkGfm from "remark-gfm";
|
|
8
|
+
import remarkParse from "remark-parse";
|
|
9
|
+
import remarkRehype from "remark-rehype";
|
|
10
|
+
import { unified } from "unified";
|
|
11
|
+
const processor = unified()
|
|
12
|
+
.use(remarkParse)
|
|
13
|
+
.use(remarkGfm)
|
|
14
|
+
.use(remarkRehype)
|
|
15
|
+
.use(rehypeSanitize)
|
|
16
|
+
.use(rehypeStringify);
|
|
17
|
+
// Render a markdown document body to sanitized HTML. rehype-sanitize's default
|
|
18
|
+
// schema drops <script>, event handlers, and non-safe URL protocols.
|
|
19
|
+
export function renderMarkdown(md) {
|
|
20
|
+
return String(processor.processSync(md));
|
|
21
|
+
}
|
|
22
|
+
function walk(node, fn) {
|
|
23
|
+
fn(node);
|
|
24
|
+
if (node.children)
|
|
25
|
+
for (const child of node.children)
|
|
26
|
+
walk(child, fn);
|
|
27
|
+
}
|
|
28
|
+
function textContent(node) {
|
|
29
|
+
if (node.type === "text")
|
|
30
|
+
return node.value ?? "";
|
|
31
|
+
if (!node.children)
|
|
32
|
+
return "";
|
|
33
|
+
return node.children.map(textContent).join("");
|
|
34
|
+
}
|
|
35
|
+
function slugify(text) {
|
|
36
|
+
const base = text
|
|
37
|
+
.toLowerCase()
|
|
38
|
+
.trim()
|
|
39
|
+
.replace(/[^\w\s-]/g, "")
|
|
40
|
+
.replace(/\s+/g, "-")
|
|
41
|
+
.replace(/-+/g, "-")
|
|
42
|
+
.replace(/^-|-$/g, "");
|
|
43
|
+
return base.length > 0 ? base : "section";
|
|
44
|
+
}
|
|
45
|
+
const HEADING_TAGS = new Set(["h1", "h2", "h3"]);
|
|
46
|
+
// Render a DOCUMENT body: sanitized HTML plus, applied AFTER sanitize (so we
|
|
47
|
+
// only add attributes we control):
|
|
48
|
+
// - in-vault link resolution — a relative link to another vault doc becomes
|
|
49
|
+
// /doc/<canonical>, resolved by the SAME resolver backlinks use so the two
|
|
50
|
+
// never drift. External/anchor/absolute links are untouched.
|
|
51
|
+
// - heading anchors + a collected table of contents (h1–h3).
|
|
52
|
+
export function renderDocBody(md, opts = {}) {
|
|
53
|
+
const toc = [];
|
|
54
|
+
const usedIds = new Set();
|
|
55
|
+
const docProcessor = unified()
|
|
56
|
+
.use(remarkParse)
|
|
57
|
+
.use(remarkGfm)
|
|
58
|
+
.use(remarkRehype)
|
|
59
|
+
.use(rehypeSanitize)
|
|
60
|
+
.use(() => (tree) => {
|
|
61
|
+
walk(tree, (node) => {
|
|
62
|
+
if (node.type !== "element")
|
|
63
|
+
return;
|
|
64
|
+
if (node.tagName === "a" && opts.resolveLink) {
|
|
65
|
+
const href = node.properties?.href;
|
|
66
|
+
// Only rewrite in-vault relative targets: skip scheme://, mailto:,
|
|
67
|
+
// root-absolute, and pure #anchor links.
|
|
68
|
+
if (typeof href === "string" && !/^([a-z][a-z0-9+.-]*:|\/|#)/i.test(href)) {
|
|
69
|
+
const bare = href.split("#")[0] ?? href;
|
|
70
|
+
const hit = opts.resolveLink(bare);
|
|
71
|
+
if (hit) {
|
|
72
|
+
node.properties = node.properties ?? {};
|
|
73
|
+
node.properties.href = `/doc/${encodeURI(hit)}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (node.tagName && HEADING_TAGS.has(node.tagName)) {
|
|
78
|
+
const text = textContent(node).trim();
|
|
79
|
+
if (text.length === 0)
|
|
80
|
+
return;
|
|
81
|
+
let id = slugify(text);
|
|
82
|
+
let n = 1;
|
|
83
|
+
while (usedIds.has(id)) {
|
|
84
|
+
n += 1;
|
|
85
|
+
id = `${slugify(text)}-${n}`;
|
|
86
|
+
}
|
|
87
|
+
usedIds.add(id);
|
|
88
|
+
node.properties = node.properties ?? {};
|
|
89
|
+
if (typeof node.properties.id !== "string")
|
|
90
|
+
node.properties.id = id;
|
|
91
|
+
toc.push({ depth: Number(node.tagName[1]), text, id: node.properties.id });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
})
|
|
95
|
+
.use(rehypeStringify);
|
|
96
|
+
const html = String(docProcessor.processSync(md));
|
|
97
|
+
return { html, toc };
|
|
98
|
+
}
|
|
99
|
+
// Escape a string for interpolation into HTML text/attribute context.
|
|
100
|
+
export function escHtml(s) {
|
|
101
|
+
return String(s)
|
|
102
|
+
.replace(/&/g, "&")
|
|
103
|
+
.replace(/</g, "<")
|
|
104
|
+
.replace(/>/g, ">")
|
|
105
|
+
.replace(/"/g, """);
|
|
106
|
+
}
|
|
107
|
+
// Serialize a value for safe embedding inside an inline <script>. JSON.stringify
|
|
108
|
+
// alone is unsafe there: an unescaped "<" lets a "</script>" in the data close
|
|
109
|
+
// the element early (breakout), and U+2028/U+2029 are valid JSON but illegal raw
|
|
110
|
+
// in a JS string. Escaping them keeps the payload inert and JSON-identical.
|
|
111
|
+
export function jsonForScript(value) {
|
|
112
|
+
return JSON.stringify(value)
|
|
113
|
+
.replace(/</g, "\\u003c")
|
|
114
|
+
.replace(/\u2028/g, "\\u2028")
|
|
115
|
+
.replace(/\u2029/g, "\\u2029");
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/view/render.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAEhF,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,SAAS,GAAG,OAAO,EAAE;KACxB,GAAG,CAAC,WAAW,CAAC;KAChB,GAAG,CAAC,SAAS,CAAC;KACd,GAAG,CAAC,YAAY,CAAC;KACjB,GAAG,CAAC,cAAc,CAAC;KACnB,GAAG,CAAC,eAAe,CAAC,CAAC;AAExB,+EAA+E;AAC/E,qEAAqE;AACrE,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAmBD,SAAS,IAAI,CAAC,IAAc,EAAE,EAAyB;IACrD,EAAE,CAAC,IAAI,CAAC,CAAC;IACT,IAAI,IAAI,CAAC,QAAQ;QAAE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,WAAW,CAAC,IAAc;IACjC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAClD,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO,IA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