markshelf 0.7.0 → 0.9.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +11 -11
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/asset/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/diff/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/raw/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/timeline/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/tree/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/watch/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{1q96_modules_mermaid_dist_chunks_mermaid_core_sizeCapture-INFHLROL_mjs_1ogo6n9k2rgi4._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_sizeCapture-INFHLROL_mjs_1mq1p9flxqx65._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e4ml2_62oajv._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0eg7wjh-6h9jf._.js +10 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0qcba441g9j7r._.js → [root-of-the-server]__17_rqmx62cz59._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_1-ydhedb1fxsp._.js → node_modules_0-kltcyqgad7k._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_0jlp8j5ogj6ku._.js → node_modules_0jxaz2e5w2cuj._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_1512e5-8q8157._.js → node_modules_1c68lxafmnoad._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_04qg5bar2ldzl._.js → node_modules_1j6p_d23zw2ot._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_15yi5hitci_xg._.js → node_modules_1q6uhrxleh9ri._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_18giqcyh1vd1y._.js → node_modules_20npetuy1mdty._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_0vn8q0im74u1u._.js → node_modules_next_dist_0cbzfnmfs57ie._.js} +2 -2
- package/.next/standalone/.next/server/middleware-build-manifest.js +11 -11
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/preview-props.json +3 -3
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/0wr6kk5jmu7qu.css +2 -0
- package/.next/standalone/.next/static/chunks/1gbw1b68p1p8h.js +8 -0
- package/.next/standalone/.next/static/chunks/{40_g3waus-lwg.js → 2h3bcm93lqikv.js} +3 -3
- package/.next/standalone/.next/static/chunks/359_hc641qco7.js +31 -0
- package/.next/standalone/docs//344/273/225/346/247/230/README.md +74 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC3-UI/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210/SPEC3.5-Markdown/343/203/254/343/203/263/343/203/200/343/203/252/343/203/263/343/202/260.md +28 -5
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.4-watch.md +26 -0
- package/.next/standalone/package-lock.json +57 -2
- package/.next/standalone/package.json +2 -1
- package/.next/standalone/src/app/layout.tsx +1 -0
- package/.next/standalone/src/app/markdown.css +361 -0
- package/.next/standalone/src/components/DetailPanel.tsx +2 -1
- package/.next/standalone/src/components/Markdown.tsx +132 -54
- package/.next/standalone/src/components/MermaidBlock.tsx +177 -5
- package/.next/standalone/src/lib/remarkAlerts.test.ts +40 -0
- package/.next/standalone/src/lib/remarkAlerts.ts +59 -0
- package/.next/static/chunks/0wr6kk5jmu7qu.css +2 -0
- package/.next/static/chunks/1gbw1b68p1p8h.js +8 -0
- package/.next/static/chunks/{40_g3waus-lwg.js → 2h3bcm93lqikv.js} +3 -3
- package/.next/static/chunks/359_hc641qco7.js +31 -0
- package/package.json +2 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__113dl-108b6lu._.js +0 -10
- package/.next/standalone/.next/static/chunks/1_r_ieqrdfmfe.css +0 -1
- package/.next/standalone/.next/static/chunks/3s3m8ud2li2il.js +0 -8
- package/.next/standalone/.next/static/chunks/3u-e5t857212e.js +0 -31
- package/.next/static/chunks/1_r_ieqrdfmfe.css +0 -1
- package/.next/static/chunks/3s3m8ud2li2il.js +0 -8
- package/.next/static/chunks/3u-e5t857212e.js +0 -31
- /package/.next/standalone/.next/static/{d5WTefQHvkibk8_NfsU7s → 9u-UWrYhqOePy2N3WxC2_}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{d5WTefQHvkibk8_NfsU7s → 9u-UWrYhqOePy2N3WxC2_}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{d5WTefQHvkibk8_NfsU7s → 9u-UWrYhqOePy2N3WxC2_}/_ssgManifest.js +0 -0
- /package/.next/static/{d5WTefQHvkibk8_NfsU7s → 9u-UWrYhqOePy2N3WxC2_}/_buildManifest.js +0 -0
- /package/.next/static/{d5WTefQHvkibk8_NfsU7s → 9u-UWrYhqOePy2N3WxC2_}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{d5WTefQHvkibk8_NfsU7s → 9u-UWrYhqOePy2N3WxC2_}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Markdown body styles (src/components/Markdown.tsx).
|
|
3
|
+
* A GitHub-like reading theme, modeled on md-reader: centered measure,
|
|
4
|
+
* generous line-height, clear heading hierarchy, framed code and tables.
|
|
5
|
+
*
|
|
6
|
+
* .md-body.md-reader main content pane
|
|
7
|
+
* .md-body.md-compact hover preview popup
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
.md-body {
|
|
11
|
+
--md-fg: var(--text-primary);
|
|
12
|
+
--md-fg-soft: #2f3440;
|
|
13
|
+
--md-fg-muted: #656d76;
|
|
14
|
+
--md-border: #d8dee4;
|
|
15
|
+
--md-border-soft: #e6eaef;
|
|
16
|
+
--md-code-bg: #f6f8fa;
|
|
17
|
+
--md-inline-code-bg: rgba(175, 184, 193, 0.2);
|
|
18
|
+
--md-link: var(--brand-primary);
|
|
19
|
+
--md-mark: #fff8c5;
|
|
20
|
+
|
|
21
|
+
color: var(--md-fg-soft);
|
|
22
|
+
font-size: 15px;
|
|
23
|
+
line-height: 1.8;
|
|
24
|
+
word-wrap: break-word;
|
|
25
|
+
overflow-wrap: anywhere;
|
|
26
|
+
letter-spacing: 0.02em;
|
|
27
|
+
font-feature-settings: "palt" 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.md-reader {
|
|
31
|
+
max-width: 860px;
|
|
32
|
+
margin: 0 auto;
|
|
33
|
+
font-size: 16px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.md-compact {
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
line-height: 1.7;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.md-body > :first-child { margin-top: 0 !important; }
|
|
42
|
+
.md-body > :last-child { margin-bottom: 0 !important; }
|
|
43
|
+
|
|
44
|
+
/* ---- Block spacing ---------------------------------------------------- */
|
|
45
|
+
|
|
46
|
+
.md-body p,
|
|
47
|
+
.md-body ul,
|
|
48
|
+
.md-body ol,
|
|
49
|
+
.md-body dl,
|
|
50
|
+
.md-body table,
|
|
51
|
+
.md-body .md-table-wrap,
|
|
52
|
+
.md-body blockquote,
|
|
53
|
+
.md-body .md-code,
|
|
54
|
+
.md-body .md-alert,
|
|
55
|
+
.md-body details {
|
|
56
|
+
margin-top: 0;
|
|
57
|
+
margin-bottom: 1.1em;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* ---- Headings --------------------------------------------------------- */
|
|
61
|
+
|
|
62
|
+
.md-body h1,
|
|
63
|
+
.md-body h2,
|
|
64
|
+
.md-body h3,
|
|
65
|
+
.md-body h4,
|
|
66
|
+
.md-body h5,
|
|
67
|
+
.md-body h6 {
|
|
68
|
+
color: var(--md-fg);
|
|
69
|
+
font-weight: 650;
|
|
70
|
+
line-height: 1.35;
|
|
71
|
+
letter-spacing: 0.01em;
|
|
72
|
+
margin-top: 1.9em;
|
|
73
|
+
margin-bottom: 0.8em;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.md-body h1 {
|
|
77
|
+
font-size: 2em;
|
|
78
|
+
font-weight: 700;
|
|
79
|
+
padding-bottom: 0.3em;
|
|
80
|
+
border-bottom: 1px solid var(--md-border);
|
|
81
|
+
}
|
|
82
|
+
.md-body h2 {
|
|
83
|
+
font-size: 1.5em;
|
|
84
|
+
padding-bottom: 0.3em;
|
|
85
|
+
border-bottom: 1px solid var(--md-border-soft);
|
|
86
|
+
}
|
|
87
|
+
.md-body h3 { font-size: 1.25em; }
|
|
88
|
+
.md-body h4 { font-size: 1.05em; }
|
|
89
|
+
.md-body h5 { font-size: 0.95em; }
|
|
90
|
+
.md-body h6 { font-size: 0.9em; color: var(--md-fg-muted); }
|
|
91
|
+
|
|
92
|
+
.md-compact h1 { font-size: 1.45em; }
|
|
93
|
+
.md-compact h2 { font-size: 1.25em; }
|
|
94
|
+
.md-compact h3 { font-size: 1.1em; }
|
|
95
|
+
.md-compact h1,
|
|
96
|
+
.md-compact h2,
|
|
97
|
+
.md-compact h3,
|
|
98
|
+
.md-compact h4 { margin-top: 1.3em; margin-bottom: 0.5em; }
|
|
99
|
+
|
|
100
|
+
.md-heading-anchor {
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
margin-left: 0.4em;
|
|
104
|
+
vertical-align: middle;
|
|
105
|
+
color: var(--text-muted);
|
|
106
|
+
opacity: 0;
|
|
107
|
+
transition: opacity 0.15s, color 0.15s;
|
|
108
|
+
}
|
|
109
|
+
.md-body .group:hover .md-heading-anchor,
|
|
110
|
+
.md-heading-anchor:focus-visible { opacity: 1; }
|
|
111
|
+
.md-heading-anchor:hover { color: var(--md-link); }
|
|
112
|
+
|
|
113
|
+
/* ---- Inline ----------------------------------------------------------- */
|
|
114
|
+
|
|
115
|
+
.md-body strong { color: var(--md-fg); font-weight: 650; }
|
|
116
|
+
.md-body a { color: var(--md-link); text-decoration: none; }
|
|
117
|
+
.md-body a:hover { text-decoration: underline; text-underline-offset: 2px; }
|
|
118
|
+
.md-body mark { background: var(--md-mark); color: inherit; padding: 0 0.15em; border-radius: 2px; }
|
|
119
|
+
.md-body del { color: var(--md-fg-muted); }
|
|
120
|
+
.md-body kbd {
|
|
121
|
+
display: inline-block;
|
|
122
|
+
padding: 0.1em 0.4em;
|
|
123
|
+
font: 0.8em var(--font-mono);
|
|
124
|
+
line-height: 1.4;
|
|
125
|
+
color: var(--md-fg);
|
|
126
|
+
background: var(--md-code-bg);
|
|
127
|
+
border: 1px solid var(--md-border);
|
|
128
|
+
border-bottom-color: #c3cad2;
|
|
129
|
+
border-radius: 5px;
|
|
130
|
+
box-shadow: inset 0 -1px 0 #c3cad2;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.md-body :not(pre) > code {
|
|
134
|
+
font-family: var(--font-mono);
|
|
135
|
+
font-size: 0.86em;
|
|
136
|
+
padding: 0.15em 0.4em;
|
|
137
|
+
margin: 0 0.1em;
|
|
138
|
+
color: var(--md-fg);
|
|
139
|
+
background: var(--md-inline-code-bg);
|
|
140
|
+
border-radius: 6px;
|
|
141
|
+
white-space: break-spaces;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* ---- Lists ------------------------------------------------------------ */
|
|
145
|
+
|
|
146
|
+
.md-body ul,
|
|
147
|
+
.md-body ol { padding-left: 1.8em; }
|
|
148
|
+
.md-body ul { list-style: disc; }
|
|
149
|
+
.md-body ol { list-style: decimal; }
|
|
150
|
+
.md-body ul ul { list-style: circle; }
|
|
151
|
+
.md-body ul ul ul { list-style: square; }
|
|
152
|
+
.md-body li + li { margin-top: 0.3em; }
|
|
153
|
+
.md-body li > ul,
|
|
154
|
+
.md-body li > ol { margin-top: 0.3em; margin-bottom: 0; }
|
|
155
|
+
.md-body li::marker { color: var(--md-fg-muted); }
|
|
156
|
+
|
|
157
|
+
/* GFM task lists */
|
|
158
|
+
.md-body .contains-task-list { list-style: none; padding-left: 0.4em; }
|
|
159
|
+
.md-body .contains-task-list .contains-task-list { padding-left: 1.6em; }
|
|
160
|
+
.md-body .task-list-item input[type="checkbox"] {
|
|
161
|
+
margin: 0 0.5em 0.2em 0;
|
|
162
|
+
vertical-align: middle;
|
|
163
|
+
accent-color: var(--md-link);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* ---- Blockquote ------------------------------------------------------- */
|
|
167
|
+
|
|
168
|
+
.md-body blockquote {
|
|
169
|
+
padding: 0.1em 1em;
|
|
170
|
+
color: var(--md-fg-muted);
|
|
171
|
+
border-left: 0.25em solid var(--md-border);
|
|
172
|
+
}
|
|
173
|
+
.md-body blockquote > :last-child { margin-bottom: 0; }
|
|
174
|
+
|
|
175
|
+
/* ---- Alerts (> [!NOTE] …) -------------------------------------------- */
|
|
176
|
+
|
|
177
|
+
.md-alert {
|
|
178
|
+
--alert-color: #0969da;
|
|
179
|
+
padding: 0.6em 1em;
|
|
180
|
+
border-left: 0.25em solid var(--alert-color);
|
|
181
|
+
background: color-mix(in srgb, var(--alert-color) 6%, transparent);
|
|
182
|
+
border-radius: 0 6px 6px 0;
|
|
183
|
+
}
|
|
184
|
+
.md-alert > :last-child { margin-bottom: 0; }
|
|
185
|
+
.md-alert .md-alert-title {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 0.45em;
|
|
189
|
+
margin-bottom: 0.35em;
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
color: var(--alert-color);
|
|
192
|
+
}
|
|
193
|
+
.md-alert-note { --alert-color: #0969da; }
|
|
194
|
+
.md-alert-tip { --alert-color: #1a7f37; }
|
|
195
|
+
.md-alert-important { --alert-color: #8250df; }
|
|
196
|
+
.md-alert-warning { --alert-color: #9a6700; }
|
|
197
|
+
.md-alert-caution { --alert-color: #cf222e; }
|
|
198
|
+
|
|
199
|
+
/* ---- Code blocks ------------------------------------------------------ */
|
|
200
|
+
|
|
201
|
+
.md-code {
|
|
202
|
+
position: relative;
|
|
203
|
+
background: var(--md-code-bg);
|
|
204
|
+
border: 1px solid var(--md-border-soft);
|
|
205
|
+
border-radius: 8px;
|
|
206
|
+
}
|
|
207
|
+
.md-code-bar {
|
|
208
|
+
position: absolute;
|
|
209
|
+
top: 0;
|
|
210
|
+
right: 0;
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
gap: 0.25em;
|
|
214
|
+
padding: 0.35em 0.4em;
|
|
215
|
+
}
|
|
216
|
+
.md-code-lang {
|
|
217
|
+
font: 11px/1 var(--font-mono);
|
|
218
|
+
color: var(--md-fg-muted);
|
|
219
|
+
text-transform: lowercase;
|
|
220
|
+
user-select: none;
|
|
221
|
+
transition: opacity 0.15s;
|
|
222
|
+
}
|
|
223
|
+
.md-code-copy {
|
|
224
|
+
display: inline-flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
justify-content: center;
|
|
227
|
+
width: 26px;
|
|
228
|
+
height: 26px;
|
|
229
|
+
color: var(--md-fg-muted);
|
|
230
|
+
background: var(--bg-surface);
|
|
231
|
+
border: 1px solid var(--md-border);
|
|
232
|
+
border-radius: 6px;
|
|
233
|
+
cursor: pointer;
|
|
234
|
+
opacity: 0;
|
|
235
|
+
transition: opacity 0.15s, color 0.15s;
|
|
236
|
+
}
|
|
237
|
+
.md-code:hover .md-code-copy,
|
|
238
|
+
.md-code-copy:focus-visible { opacity: 1; }
|
|
239
|
+
.md-code-copy:hover { color: var(--md-link); }
|
|
240
|
+
.md-compact .md-code-bar { display: none; }
|
|
241
|
+
|
|
242
|
+
.md-body pre {
|
|
243
|
+
margin: 0;
|
|
244
|
+
padding: 1em 1.2em;
|
|
245
|
+
overflow-x: auto;
|
|
246
|
+
font-family: var(--font-mono);
|
|
247
|
+
font-size: 0.85em;
|
|
248
|
+
line-height: 1.6;
|
|
249
|
+
color: #1f2328;
|
|
250
|
+
tab-size: 4;
|
|
251
|
+
letter-spacing: 0;
|
|
252
|
+
}
|
|
253
|
+
.md-body pre code {
|
|
254
|
+
font: inherit;
|
|
255
|
+
background: transparent;
|
|
256
|
+
padding: 0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* highlight.js tokens — GitHub light palette */
|
|
260
|
+
.hljs-doctag,
|
|
261
|
+
.hljs-keyword,
|
|
262
|
+
.hljs-meta .hljs-keyword,
|
|
263
|
+
.hljs-template-tag,
|
|
264
|
+
.hljs-template-variable,
|
|
265
|
+
.hljs-type,
|
|
266
|
+
.hljs-variable.language_ { color: #cf222e; }
|
|
267
|
+
.hljs-title,
|
|
268
|
+
.hljs-title.class_,
|
|
269
|
+
.hljs-title.class_.inherited__,
|
|
270
|
+
.hljs-title.function_ { color: #8250df; }
|
|
271
|
+
.hljs-attr,
|
|
272
|
+
.hljs-attribute,
|
|
273
|
+
.hljs-literal,
|
|
274
|
+
.hljs-meta,
|
|
275
|
+
.hljs-number,
|
|
276
|
+
.hljs-operator,
|
|
277
|
+
.hljs-variable,
|
|
278
|
+
.hljs-selector-attr,
|
|
279
|
+
.hljs-selector-class,
|
|
280
|
+
.hljs-selector-id { color: #0550ae; }
|
|
281
|
+
.hljs-regexp,
|
|
282
|
+
.hljs-string,
|
|
283
|
+
.hljs-meta .hljs-string { color: #0a3069; }
|
|
284
|
+
.hljs-built_in,
|
|
285
|
+
.hljs-symbol { color: #953800; }
|
|
286
|
+
.hljs-comment,
|
|
287
|
+
.hljs-code,
|
|
288
|
+
.hljs-formula { color: #6e7781; font-style: italic; }
|
|
289
|
+
.hljs-name,
|
|
290
|
+
.hljs-quote,
|
|
291
|
+
.hljs-selector-tag,
|
|
292
|
+
.hljs-selector-pseudo { color: #116329; }
|
|
293
|
+
.hljs-subst { color: #1f2328; }
|
|
294
|
+
.hljs-section { color: #0550ae; font-weight: 600; }
|
|
295
|
+
.hljs-bullet { color: #953800; }
|
|
296
|
+
.hljs-emphasis { font-style: italic; }
|
|
297
|
+
.hljs-strong { font-weight: 600; }
|
|
298
|
+
.hljs-addition { color: #116329; background: #dafbe1; }
|
|
299
|
+
.hljs-deletion { color: #82071e; background: #ffebe9; }
|
|
300
|
+
|
|
301
|
+
/* ---- Tables ----------------------------------------------------------- */
|
|
302
|
+
|
|
303
|
+
.md-table-wrap {
|
|
304
|
+
overflow-x: auto;
|
|
305
|
+
border: 1px solid var(--md-border);
|
|
306
|
+
border-radius: 8px;
|
|
307
|
+
}
|
|
308
|
+
.md-body table {
|
|
309
|
+
width: 100%;
|
|
310
|
+
margin: 0;
|
|
311
|
+
border-collapse: collapse;
|
|
312
|
+
font-size: 0.9em;
|
|
313
|
+
line-height: 1.6;
|
|
314
|
+
font-variant-numeric: tabular-nums;
|
|
315
|
+
}
|
|
316
|
+
.md-body th,
|
|
317
|
+
.md-body td {
|
|
318
|
+
padding: 0.5em 0.9em;
|
|
319
|
+
border-bottom: 1px solid var(--md-border-soft);
|
|
320
|
+
vertical-align: top;
|
|
321
|
+
}
|
|
322
|
+
.md-body th + th,
|
|
323
|
+
.md-body td + td { border-left: 1px solid var(--md-border-soft); }
|
|
324
|
+
.md-body thead th {
|
|
325
|
+
background: var(--md-code-bg);
|
|
326
|
+
color: var(--md-fg);
|
|
327
|
+
font-weight: 600;
|
|
328
|
+
text-align: left;
|
|
329
|
+
border-bottom-color: var(--md-border);
|
|
330
|
+
}
|
|
331
|
+
.md-body tbody tr:last-child td { border-bottom: 0; }
|
|
332
|
+
.md-body tbody tr:nth-child(even) { background: #fafbfc; }
|
|
333
|
+
.md-body tbody tr:hover { background: #f3f6fa; }
|
|
334
|
+
|
|
335
|
+
/* ---- Media, rules, footnotes ----------------------------------------- */
|
|
336
|
+
|
|
337
|
+
.md-body img {
|
|
338
|
+
max-width: 100%;
|
|
339
|
+
height: auto;
|
|
340
|
+
border-radius: 6px;
|
|
341
|
+
}
|
|
342
|
+
.md-body hr {
|
|
343
|
+
height: 1px;
|
|
344
|
+
margin: 2em 0;
|
|
345
|
+
border: 0;
|
|
346
|
+
background: var(--md-border);
|
|
347
|
+
}
|
|
348
|
+
.md-body details summary { cursor: pointer; font-weight: 600; color: var(--md-fg); }
|
|
349
|
+
.md-body dt { font-weight: 600; color: var(--md-fg); }
|
|
350
|
+
.md-body dd { margin: 0 0 0.6em 1.2em; }
|
|
351
|
+
|
|
352
|
+
.md-body .footnotes {
|
|
353
|
+
margin-top: 2.5em;
|
|
354
|
+
padding-top: 1em;
|
|
355
|
+
border-top: 1px solid var(--md-border);
|
|
356
|
+
font-size: 0.88em;
|
|
357
|
+
color: var(--md-fg-muted);
|
|
358
|
+
}
|
|
359
|
+
.md-body .footnotes h2 { font-size: 1em; border: 0; margin-top: 0; }
|
|
360
|
+
.md-body sup a[data-footnote-ref]::before { content: "["; }
|
|
361
|
+
.md-body sup a[data-footnote-ref]::after { content: "]"; }
|
|
@@ -243,8 +243,9 @@ export function DetailPanel({ filePath, fileRefs, folders, onNavigate, onGoBack,
|
|
|
243
243
|
content !== null ? (
|
|
244
244
|
<div className="flex-1 flex overflow-hidden">
|
|
245
245
|
<div className="flex-1 overflow-y-auto" ref={scrollRef}>
|
|
246
|
-
<div className="
|
|
246
|
+
<div className="px-6 py-8 md:px-10">
|
|
247
247
|
<Markdown
|
|
248
|
+
variant="reader"
|
|
248
249
|
enableHeadingLinks
|
|
249
250
|
onHeadingsExtracted={setHeadings}
|
|
250
251
|
fileRefs={fileRefs}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useEffect, useMemo, useState } from "react";
|
|
4
|
-
import ReactMarkdown, { Components } from "react-markdown";
|
|
3
|
+
import { isValidElement, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import ReactMarkdown, { type Components, type Options } from "react-markdown";
|
|
5
5
|
import remarkGfm from "remark-gfm";
|
|
6
|
-
import
|
|
6
|
+
import rehypeHighlight from "rehype-highlight";
|
|
7
|
+
import {
|
|
8
|
+
Link2,
|
|
9
|
+
Check,
|
|
10
|
+
Copy,
|
|
11
|
+
Info,
|
|
12
|
+
Lightbulb,
|
|
13
|
+
MessageSquareWarning,
|
|
14
|
+
TriangleAlert,
|
|
15
|
+
OctagonAlert,
|
|
16
|
+
} from "lucide-react";
|
|
17
|
+
import { remarkAlerts, type AlertType } from "@/lib/remarkAlerts";
|
|
7
18
|
import type { HeadingInfo } from "./TableOfContents";
|
|
8
19
|
import { MermaidBlock } from "./MermaidBlock";
|
|
9
20
|
import { withBasePath } from "@/lib/basePath";
|
|
@@ -24,8 +35,28 @@ interface Props {
|
|
|
24
35
|
onPreviewHide?: () => void;
|
|
25
36
|
/** Show a per-heading anchor link that copies a shareable URL (main content only). */
|
|
26
37
|
enableHeadingLinks?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* "reader": roomy, centered layout for the main content pane.
|
|
40
|
+
* "compact": dense layout for hover previews.
|
|
41
|
+
*/
|
|
42
|
+
variant?: "reader" | "compact";
|
|
27
43
|
}
|
|
28
44
|
|
|
45
|
+
const REMARK_PLUGINS: Options["remarkPlugins"] = [remarkGfm, remarkAlerts];
|
|
46
|
+
// Only fenced blocks with an explicit language are highlighted; mermaid stays
|
|
47
|
+
// plain text so <MermaidBlock> receives the raw source.
|
|
48
|
+
const REHYPE_PLUGINS: Options["rehypePlugins"] = [
|
|
49
|
+
[rehypeHighlight, { detect: false, plainText: ["mermaid"] }],
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const ALERTS: Record<AlertType, { label: string; Icon: typeof Info }> = {
|
|
53
|
+
note: { label: "Note", Icon: Info },
|
|
54
|
+
tip: { label: "Tip", Icon: Lightbulb },
|
|
55
|
+
important: { label: "Important", Icon: MessageSquareWarning },
|
|
56
|
+
warning: { label: "Warning", Icon: TriangleAlert },
|
|
57
|
+
caution: { label: "Caution", Icon: OctagonAlert },
|
|
58
|
+
};
|
|
59
|
+
|
|
29
60
|
/** Copy text via a temporary textarea + execCommand (works without a secure context). */
|
|
30
61
|
function legacyCopy(text: string): boolean {
|
|
31
62
|
const ta = document.createElement("textarea");
|
|
@@ -53,47 +84,96 @@ function legacyCopy(text: string): boolean {
|
|
|
53
84
|
* clipboard so it can be sent to someone else and opened scrolled to that spot.
|
|
54
85
|
*/
|
|
55
86
|
function HeadingAnchor({ id }: { id: string }) {
|
|
56
|
-
const [copied,
|
|
87
|
+
const [copied, copy] = useCopied();
|
|
57
88
|
|
|
58
89
|
const handleClick = (e: React.MouseEvent) => {
|
|
59
90
|
e.preventDefault();
|
|
60
|
-
if (typeof window === "undefined") return;
|
|
61
91
|
const url = new URL(window.location.href);
|
|
62
92
|
url.hash = id;
|
|
63
93
|
const full = url.toString();
|
|
64
94
|
window.history.replaceState(null, "", full);
|
|
65
|
-
|
|
66
|
-
setCopied(true);
|
|
67
|
-
window.setTimeout(() => setCopied(false), 1500);
|
|
68
|
-
};
|
|
69
|
-
// navigator.clipboard is only available in secure contexts (HTTPS or
|
|
70
|
-
// localhost). When served over plain HTTP from another host it is
|
|
71
|
-
// undefined, so fall back to the legacy execCommand approach.
|
|
72
|
-
if (window.isSecureContext && navigator.clipboard?.writeText) {
|
|
73
|
-
navigator.clipboard
|
|
74
|
-
.writeText(full)
|
|
75
|
-
.then(done)
|
|
76
|
-
.catch(() => {
|
|
77
|
-
if (legacyCopy(full)) done();
|
|
78
|
-
});
|
|
79
|
-
} else if (legacyCopy(full)) {
|
|
80
|
-
done();
|
|
81
|
-
}
|
|
95
|
+
copy(full);
|
|
82
96
|
};
|
|
83
97
|
|
|
84
98
|
return (
|
|
85
99
|
<a
|
|
86
100
|
href={`#${id}`}
|
|
87
101
|
onClick={handleClick}
|
|
88
|
-
className="
|
|
102
|
+
className="md-heading-anchor"
|
|
89
103
|
title={copied ? "リンクをコピーしました" : "このヘッダーへのリンクをコピー"}
|
|
90
104
|
aria-label="このヘッダーへのリンクをコピー"
|
|
91
105
|
>
|
|
92
|
-
{copied ? <Check size={
|
|
106
|
+
{copied ? <Check size={14} /> : <Link2 size={14} />}
|
|
93
107
|
</a>
|
|
94
108
|
);
|
|
95
109
|
}
|
|
96
110
|
|
|
111
|
+
/** Copy to the clipboard, falling back to execCommand outside secure contexts. */
|
|
112
|
+
async function copyText(text: string): Promise<boolean> {
|
|
113
|
+
// navigator.clipboard is only available in secure contexts (HTTPS or
|
|
114
|
+
// localhost). When served over plain HTTP from another host it is
|
|
115
|
+
// undefined, so fall back to the legacy execCommand approach.
|
|
116
|
+
if (window.isSecureContext && navigator.clipboard?.writeText) {
|
|
117
|
+
try {
|
|
118
|
+
await navigator.clipboard.writeText(text);
|
|
119
|
+
return true;
|
|
120
|
+
} catch {
|
|
121
|
+
return legacyCopy(text);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return legacyCopy(text);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Copy text and show a check mark for a moment afterwards. */
|
|
128
|
+
function useCopied(): [boolean, (text: string) => void] {
|
|
129
|
+
const [copied, setCopied] = useState(false);
|
|
130
|
+
const copy = (text: string) => {
|
|
131
|
+
void copyText(text).then((ok) => {
|
|
132
|
+
if (!ok) return;
|
|
133
|
+
setCopied(true);
|
|
134
|
+
window.setTimeout(() => setCopied(false), 1500);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
return [copied, copy];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Fenced code block with a language label and a copy button. */
|
|
141
|
+
function CodeBlock({ language, children }: { language: string | null; children: React.ReactNode }) {
|
|
142
|
+
const preRef = useRef<HTMLPreElement>(null);
|
|
143
|
+
const [copied, copy] = useCopied();
|
|
144
|
+
return (
|
|
145
|
+
<div className="md-code">
|
|
146
|
+
<div className="md-code-bar">
|
|
147
|
+
<span className="md-code-lang">{language ?? ""}</span>
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
className="md-code-copy"
|
|
151
|
+
onClick={() => copy(preRef.current?.textContent ?? "")}
|
|
152
|
+
title={copied ? "コピーしました" : "コードをコピー"}
|
|
153
|
+
aria-label="コードをコピー"
|
|
154
|
+
>
|
|
155
|
+
{copied ? <Check size={13} /> : <Copy size={13} />}
|
|
156
|
+
</button>
|
|
157
|
+
</div>
|
|
158
|
+
<pre ref={preRef}>{children}</pre>
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** GitHub-style alert box (`> [!NOTE]` etc., see remarkAlerts). */
|
|
164
|
+
function Alert({ type, children }: { type: AlertType; children: React.ReactNode }) {
|
|
165
|
+
const { label, Icon } = ALERTS[type];
|
|
166
|
+
return (
|
|
167
|
+
<div className={`md-alert md-alert-${type}`} role="note">
|
|
168
|
+
<p className="md-alert-title">
|
|
169
|
+
<Icon size={15} aria-hidden />
|
|
170
|
+
{label}
|
|
171
|
+
</p>
|
|
172
|
+
{children}
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
97
177
|
export function Markdown({
|
|
98
178
|
children,
|
|
99
179
|
onHeadingsExtracted,
|
|
@@ -103,6 +183,7 @@ export function Markdown({
|
|
|
103
183
|
onPreviewShow,
|
|
104
184
|
onPreviewHide,
|
|
105
185
|
enableHeadingLinks = false,
|
|
186
|
+
variant = "compact",
|
|
106
187
|
}: Props) {
|
|
107
188
|
// Parse headings deterministically from the markdown source
|
|
108
189
|
const headings = useMemo(() => parseHeadings(children), [children]);
|
|
@@ -230,10 +311,10 @@ export function Markdown({
|
|
|
230
311
|
: extractText(headingChildren);
|
|
231
312
|
const id = getIdForHeading(text);
|
|
232
313
|
|
|
233
|
-
// `scroll-mt-
|
|
314
|
+
// `scroll-mt-6` keeps the heading clear of the container's top edge when
|
|
234
315
|
// scrolled to via a shared hash link; `group` drives the anchor's hover.
|
|
235
316
|
const mergedClassName = enableHeadingLinks
|
|
236
|
-
? `group scroll-mt-
|
|
317
|
+
? `group scroll-mt-6${className ? ` ${className}` : ""}`
|
|
237
318
|
: className;
|
|
238
319
|
const hProps = { ...props, id, className: mergedClassName };
|
|
239
320
|
const inner = (
|
|
@@ -268,16 +349,28 @@ export function Markdown({
|
|
|
268
349
|
// Wrap pre to avoid nesting issues with mermaid blocks
|
|
269
350
|
pre: ({ children }) => {
|
|
270
351
|
// If the child is a MermaidBlock (rendered from code), don't wrap in <pre>
|
|
271
|
-
if (
|
|
272
|
-
children &&
|
|
273
|
-
typeof children === "object" &&
|
|
274
|
-
"type" in children &&
|
|
275
|
-
(children as React.ReactElement).type === MermaidBlock
|
|
276
|
-
) {
|
|
352
|
+
if (isValidElement(children) && children.type === MermaidBlock) {
|
|
277
353
|
return <>{children}</>;
|
|
278
354
|
}
|
|
279
|
-
|
|
355
|
+
const codeClass = isValidElement<{ className?: string }>(children)
|
|
356
|
+
? (children.props.className ?? "")
|
|
357
|
+
: "";
|
|
358
|
+
const language = /language-([\w+#-]+)/.exec(codeClass)?.[1] ?? null;
|
|
359
|
+
return <CodeBlock language={language}>{children}</CodeBlock>;
|
|
360
|
+
},
|
|
361
|
+
blockquote: ({ children, node }) => {
|
|
362
|
+
const type = node?.properties?.dataAlert;
|
|
363
|
+
if (typeof type === "string" && type in ALERTS) {
|
|
364
|
+
return <Alert type={type as AlertType}>{children}</Alert>;
|
|
365
|
+
}
|
|
366
|
+
return <blockquote>{children}</blockquote>;
|
|
280
367
|
},
|
|
368
|
+
// Wide tables scroll horizontally instead of overflowing the pane.
|
|
369
|
+
table: ({ children }) => (
|
|
370
|
+
<div className="md-table-wrap">
|
|
371
|
+
<table>{children}</table>
|
|
372
|
+
</div>
|
|
373
|
+
),
|
|
281
374
|
// Resolve relative markdown links to docs paths so they navigate in-app.
|
|
282
375
|
a: ({ href, children: linkChildren, ...rest }) => {
|
|
283
376
|
const targetPath = href ? resolveRelativeLink(href) : null;
|
|
@@ -318,27 +411,12 @@ export function Markdown({
|
|
|
318
411
|
};
|
|
319
412
|
|
|
320
413
|
return (
|
|
321
|
-
<div
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
prose-p:text-[var(--text-secondary)] prose-p:text-[13px] prose-p:leading-[1.75]
|
|
328
|
-
prose-li:text-[var(--text-secondary)] prose-li:text-[13px] prose-li:leading-[1.75]
|
|
329
|
-
prose-strong:text-[var(--text-primary)] prose-strong:font-semibold
|
|
330
|
-
prose-a:text-[var(--brand-primary)] prose-a:font-medium prose-a:no-underline hover:prose-a:underline
|
|
331
|
-
prose-code:text-xs prose-code:text-[var(--text-primary)] prose-code:bg-[var(--bg-muted)] prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none
|
|
332
|
-
prose-pre:bg-[var(--bg-muted)] prose-pre:text-xs prose-pre:text-[var(--text-primary)]
|
|
333
|
-
prose-table:text-[12px]
|
|
334
|
-
prose-th:bg-[var(--bg-muted)] prose-th:text-[var(--text-primary)] prose-th:font-semibold prose-th:px-3 prose-th:py-1.5 prose-th:text-left
|
|
335
|
-
prose-td:px-3 prose-td:py-1.5 prose-td:border-[var(--border-default)] prose-td:text-[var(--text-secondary)]
|
|
336
|
-
prose-hr:border-[var(--border-default)]
|
|
337
|
-
prose-blockquote:border-l-[var(--brand-primary)] prose-blockquote:text-[var(--text-muted)] prose-blockquote:not-italic
|
|
338
|
-
prose-img:rounded-lg
|
|
339
|
-
"
|
|
340
|
-
>
|
|
341
|
-
<ReactMarkdown remarkPlugins={[remarkGfm]} components={components}>
|
|
414
|
+
<div className={`md-body md-${variant}`}>
|
|
415
|
+
<ReactMarkdown
|
|
416
|
+
remarkPlugins={REMARK_PLUGINS}
|
|
417
|
+
rehypePlugins={REHYPE_PLUGINS}
|
|
418
|
+
components={components}
|
|
419
|
+
>
|
|
342
420
|
{children}
|
|
343
421
|
</ReactMarkdown>
|
|
344
422
|
</div>
|