Repository navigation
Expand file tree
/
Copy pathmd.html
More file actions
4950 lines (4712 loc) · 281 KB
/
Copy pathmd.html
File metadata and controls
4950 lines (4712 loc) · 281 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!-- @su:responder-script
// =============================================================================
// RESPONDER SCRIPT - paired with md.html, auto-deployed to the responder's
// `script` setting by dev/tools/deploy.ts. This HTML comment is stripped from
// the served body by html-minifier-terser (`removeComments: true`).
// See dev/tools/AGENTS.md -> "Short links (md.html)".
//
// Short-link store on the bare mount, keyed by `?s=<id>`:
// POST ?s=<id>[&ttl=<sec>] body: base64url blob, x-su-delete-token -> 201 {exp}
// GET ?s=<id> -> 200 {v, exp} | 404
// DELETE ?s=<id> x-su-delete-token -> 204 | 403 | 404
// The blob is an IV plus AES-GCM ciphertext. The key exists only in the link
// fragment, so this script stores and serves opaque bytes. Requests without
// `s` return null, and the static HTML body is served.
// =============================================================================
(() => {
const id = (context.query || {}).s;
if (!id) return null;
const TTLS = [86400, 604800, 1209600]; // 1, 7, and 14 days.
const DEFAULT_TTL = 604800;
// base64url length of 1 MiB, the KV value cap. Keep in sync with SHORT_MAX_CHARS in the page.
const MAX_CHARS = 1398100;
const MIN_CHARS = 43; // 12 B IV + 16 B GCM tag + 4 B length prefix.
const RL_WINDOW_SEC = 3600;
const RL_MAX_LINKS = 20;
const RL_MAX_BYTES = 16 * 1024 * 1024;
const TOKEN_RE = /^[A-Za-z0-9_-]{22}$/;
const json = (statusCode, obj) => ({
statusCode,
headers: { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store' },
body: obj === undefined ? '' : JSON.stringify(obj),
skipRequest: true,
});
if (!/^[A-Za-z0-9_-]{16}$/.test(id)) return json(400, { error: 'invalid-id' });
const method = (context.method || 'GET').toUpperCase();
const token = (context.headers || {})['x-su-delete-token'] || '';
if (method === 'GET') {
return (async () => {
const entry = await secutils.kv.getEntry('s/' + id);
return entry && entry.value
? json(200, { v: entry.value, exp: entry.expiresAt })
: json(404, { error: 'not-found' });
})();
}
if (method === 'POST') {
const bytes = context.body;
if (bytes.length > MAX_CHARS) return json(413, { error: 'too-large', max: MAX_CHARS });
const blob = Deno.core.decode(bytes);
if (blob.length < MIN_CHARS || blob.length % 4 === 1 || !/^[A-Za-z0-9_-]+$/.test(blob)) {
return json(400, { error: 'invalid-body' });
}
if (!TOKEN_RE.test(token)) return json(400, { error: 'invalid-token' });
const ttl = TTLS.includes(Number(context.query.ttl)) ? Number(context.query.ttl) : DEFAULT_TTL;
const ip = String(context.clientAddress || 'unknown').replace(/:\d+$/, '');
return (async () => {
// ponytail: approximate sliding window (list + set is not atomic); concurrent bursts can
// overshoot by a few links. Per-tier KV quotas remain the hard backstop.
const rlPrefix = 'rl/' + ip + '/';
const recent = await secutils.kv.list({ prefix: rlPrefix, valuesIncluded: false, limit: RL_MAX_LINKS });
const usedBytes = recent.entries.reduce((sum, e) => sum + (Number(e.key.split('.').pop()) || 0), 0);
if (recent.entries.length >= RL_MAX_LINKS || usedBytes + blob.length > RL_MAX_BYTES) {
return json(429, { error: 'rate-limited', retryAfter: RL_WINDOW_SEC });
}
let tokenHash;
try {
tokenHash = await secutils.crypto.sha256(token);
} catch (_e) {
return json(400, { error: 'invalid-token' });
}
// ponytail: ids are 96-bit hashes of client-side random secrets, so `ifAbsent` never
// meets a live row in practice. When it does, the original link is preserved.
try {
await secutils.kv.set('s/' + id, blob, { ifAbsent: true, ttlSec: ttl });
await secutils.kv.set('d/' + id, tokenHash, { ifAbsent: true, ttlSec: ttl });
} catch (e) {
return /base64url/.test(String(e && e.message))
? json(400, { error: 'invalid-body' })
: json(507, { error: 'storage-full' });
}
try {
await secutils.kv.set(rlPrefix + id + '.' + blob.length, 'AA', { ttlSec: RL_WINDOW_SEC });
} catch (_e) {
// The link is stored; a missed throttle mark only loosens the limit.
}
return json(201, { exp: Math.floor(Date.now() / 1000) + ttl });
})();
}
if (method === 'DELETE') {
if (!TOKEN_RE.test(token)) return json(403, { error: 'forbidden' });
return (async () => {
const stored = await secutils.kv.get('d/' + id);
if (!stored) return json(404, { error: 'not-found' });
let tokenHash;
try {
tokenHash = await secutils.crypto.sha256(token);
} catch (_e) {
return json(403, { error: 'forbidden' });
}
if (stored !== tokenHash) return json(403, { error: 'forbidden' });
await secutils.kv.delete('s/' + id);
await secutils.kv.delete('d/' + id);
return json(204);
})();
}
return json(405, { error: 'method-not-allowed' });
})();
-->
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Markdown Preview: Read, Render & Export Markdown | Secutils.dev</title>
<meta name="description" content="Preview Markdown with Mermaid, GeoJSON/TopoJSON maps, STL and colored 3MF models, math, and alerts. Export HTML/PDF in your browser. Free, no signup.">
<meta name="robots" content="index, follow, max-image-preview:large">
<link rel="canonical" href="https://{{TOOLS_HOST}}/md">
<meta name="su-tool-path" content="/md">
<meta name="su-tool-name" content="Markdown Preview">
<meta name="su-tool-description" content="Markdown previewer with Mermaid diagrams, GeoJSON/TopoJSON maps, STL and colored 3MF models, math, alerts, and self-contained HTML/PDF export. No signup.">
<meta name="su-tool-promote" content="true">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Secutils.dev">
<meta property="og:title" content="Markdown Preview: Read, Render & Export Markdown">
<meta property="og:description" content="Preview Markdown with Mermaid, GeoJSON/TopoJSON maps, STL models, math, and alerts. Export HTML/PDF. Browser-only, no signup.">
<meta property="og:url" content="https://{{TOOLS_HOST}}/md">
<meta property="og:image" content="https://secutils.dev/docs/img/og/og-md.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Markdown Preview on Secutils.dev: render, read, and export Markdown.">
<meta property="og:locale" content="en_US">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Markdown Preview: Read, Render & Export Markdown">
<meta name="twitter:description" content="Preview Markdown with Mermaid, GeoJSON/TopoJSON maps, STL models, math, and alerts. Export HTML/PDF. Browser-only, no signup.">
<meta name="twitter:image" content="https://secutils.dev/docs/img/og/og-md.png">
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebApplication","name":"Markdown Preview","url":"https://{{TOOLS_HOST}}/md","applicationCategory":"DeveloperApplication","operatingSystem":"Any","browserRequirements":"Requires JavaScript","isAccessibleForFree":true,"offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"publisher":{"@type":"Organization","name":"Secutils.dev","url":"https://secutils.dev"},"sameAs":"https://github.com/secutils-dev/secutils/blob/main/dev/tools/md.html","description":"Free Markdown previewer with Mermaid diagrams, GeoJSON and TopoJSON maps, ASCII STL models, KaTeX math, GitHub alerts, and self-contained HTML or print-ready PDF export. Browser-only, no signup."}</script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300..700&family=Roboto+Mono:wght@400..700&display=swap" rel="stylesheet">
<!-- Privacy-friendly analytics by Plausible -->
<script defer src="https://tools.secutils.dev/js/script.js" fetchpriority="low"></script>
<script>
window.plausible = window.plausible || function () { (plausible.q = plausible.q || []).push(arguments) };
plausible.init = plausible.init || function (i) { plausible.o = i || {} };
plausible.init();
</script>
<script>
// Show the loading state from the first paint when the page will hydrate
// from a fragment or ?url= (avoids a flash of the empty "start" panel
// while marked/highlight load and the fragment decompresses).
if (location.hash.length > 1 || /[?&]url=/.test(location.search)) {
document.documentElement.classList.add('su-loading');
}
</script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root, [data-theme="dark"] {
--bg: #141519; --surface: #1d1e24; --surface-hover: #2c2d33;
--border: #343741; --text: #dfe5ef; --text-muted: #98a2b3;
--primary: #fed047; --primary-hover: #fdc615;
--primary-text: #642340;
--primary-glow: rgba(254,208,71,0.10);
--accent: #642340;
--badge-bg: #2B394F; --badge-text: #98A8C3;
--radius: 12px;
--font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--mono: 'Roboto Mono', 'SF Mono', 'Fira Code', Consolas, monospace;
--code-bg: #16171c;
--bq-bg: #1c1d22; --bq-border: #fed047; --bq-text: #c9b870;
--hl-bg: #b9942b; --hl-text: #1d1e24;
}
[data-theme="light"] {
--bg: #f5f7fa; --surface: #ffffff; --surface-hover: #f1f3f5;
--border: #d3dae6; --text: #343741; --text-muted: #69707d;
--primary: #fed047; --primary-hover: #fdc615;
--primary-text: #642340;
--primary-glow: rgba(254,208,71,0.15);
--accent: #642340;
--badge-bg: #E3E8F2; --badge-text: #505F79;
--code-bg: #f6f8fa;
--bq-bg: #fef9e7; --bq-border: #642340; --bq-text: #4a3a2a;
--hl-bg: #fff3a3; --hl-text: #3b2f00;
}
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; transition: background .25s, color .25s; }
header { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; height: 48px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; transition: background .25s, border-color .25s; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-svg { flex-shrink: 0; }
.logo-svg .logo-text-fill { fill: var(--text); }
.logo-badge { display: inline-flex; align-items: center; padding: 4px 16px; border-radius: 4px; border: none; background: var(--badge-bg); color: var(--badge-text); font-size: 12px; font-weight: 450; line-height: 16px; white-space: nowrap; }
.header-right { display: flex; gap: 8px; align-items: center; }
/* `height` pins the outer size so `.btn-primary`'s bold weight doesn't render
1-2 px taller than the regular variant. See dev/tools/AGENTS.md -> "Buttons". */
.btn { padding: 7px 14px; height: 29px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 13px/1 var(--font); cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--text-muted); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary-text); color: var(--primary-text); font-weight: 500; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 5px 10px; height: 24px; font-size: 12px; }
.btn.active { background: var(--surface-hover); border-color: var(--text-muted); color: var(--text); }
.theme-toggle { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: all .2s; }
.theme-toggle:hover { background: var(--surface-hover); color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; fill: currentColor; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.skill-link { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text-muted); font: 12px var(--font, system-ui), sans-serif; text-decoration: none; transition: all .15s; cursor: pointer; }
.skill-link:hover { color: var(--text); border-color: var(--text-muted); background: var(--surface-hover); }
.skill-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; }
.su-more-tools { margin: 8px 0 0; padding: 12px 18px; text-align: center; border: 1px solid rgba(254, 208, 71, 0.35); border-radius: 12px; background: rgba(254, 208, 71, 0.06); font: 13px/1.55 var(--font); color: var(--text); transition: border-color .25s, background-color .25s, color .25s; }
.su-more-tools p { margin: 0; }
.su-more-tools a { color: var(--primary); font-weight: 700; text-decoration: none; white-space: nowrap; }
.su-more-tools a:hover { color: var(--primary-hover); text-decoration: underline; }
@media (max-width: 600px) { .su-more-tools { padding: 12px 14px; } .su-more-tools a { white-space: normal; } }
.su-noscript { max-width: 720px; margin: 24px auto; padding: 16px; border: 1px solid var(--border); border-radius: 8px; font: 14px/1.5 var(--font, system-ui), sans-serif; background: var(--surface); color: var(--text); }
/* Reading-first layout */
main { flex: 1; padding: 16px; display: flex; flex-direction: column; overflow: hidden; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 12px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.doc-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stats-text { font: 11px var(--mono); color: var(--text-muted); white-space: nowrap; }
/* Icon-only utility button */
.icon-btn { padding: 4px; border: none; background: none; color: var(--text-muted); cursor: pointer; border-radius: 4px; transition: all .15s; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--text); background: var(--surface-hover); }
.icon-btn svg { width: 16px; height: 16px; }
#previewPane { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
#previewPane:fullscreen { background: var(--bg); padding: 16px; }
.output-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; flex: 1; min-height: 0; transition: background .25s, border-color .25s; }
.output-scroll { flex: 1; overflow-y: auto; padding: 32px; }
.output-panel.dragover { border-color: var(--primary); background: var(--primary-glow); }
/* Segmented view switch (Preview / HTML / Source) */
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; height: 24px; }
.view-btn { appearance: none; border: none; border-right: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font: 12px/1 var(--font); padding: 0 11px; height: 100%; cursor: pointer; transition: background .15s, color .15s; }
.view-btn:last-child { border-right: none; }
.view-btn:hover:not(:disabled):not(.active) { background: var(--surface-hover); color: var(--text); }
.view-btn.active { background: var(--primary); color: var(--primary-text); font-weight: 500; }
.view-btn:disabled { opacity: .5; cursor: default; }
/* Source editor + HTML preview (hidden until their view is active) */
#editorMount { flex: 1; min-height: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: none; transition: border-color .15s, background .25s; }
#editorMount.dragover { border-color: var(--primary); background: var(--primary-glow); }
#htmlPreview { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; display: none; }
body.su-view-edit #previewWrap { display: none; }
body.su-view-edit #editorMount { display: block; }
body.su-view-html #previewWrap { display: none; }
body.su-view-html #htmlPreview { display: block; }
.cm-editor { height: 100%; font: 13px/1.6 var(--mono); }
.cm-editor.cm-focused { outline: none; }
.cm-scroller { font-family: var(--mono); }
.cm-content { padding: 8px 0; }
.cm-line { padding: 0 12px; }
.cm-gutters { background: var(--surface); border-right: 1px solid var(--border); color: var(--text-muted); }
.cm-activeLineGutter, .cm-activeLine { background: var(--surface-hover) !important; }
.cm-cursor { border-left-color: var(--primary) !important; }
.cm-selectionBackground, .cm-content ::selection { background: rgba(254, 208, 71, 0.18) !important; }
.cm-editor { color: var(--text); }
.tok-heading, .ͼ1 .tok-heading { color: #d2a8ff; font-weight: 600; }
[data-theme="light"] .tok-heading { color: #6f42c1; }
.tok-link { color: var(--primary); }
.tok-emphasis { font-style: italic; }
.tok-strong { font-weight: 700; color: var(--text); }
.tok-monospace { color: #ffa657; }
[data-theme="light"] .tok-monospace { color: #953800; }
.tok-list { color: var(--text-muted); }
.tok-quote { color: #c9b870; font-style: italic; }
[data-theme="light"] .tok-quote { color: #735c0f; }
.editor-fallback { width: 100%; height: 100%; padding: 14px; font: 13px/1.6 var(--mono); background: var(--surface); color: var(--text); border: none; outline: none; resize: none; }
/* Find-in-page bar */
.find-bar { position: absolute; top: 10px; right: 18px; z-index: 20; display: flex; align-items: center; gap: 4px; padding: 5px 6px 5px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.find-bar[hidden] { display: none; }
.find-bar input { width: 180px; max-width: 42vw; border: none; background: transparent; color: var(--text); font: 13px var(--font); outline: none; }
.find-count { font: 11px var(--mono); color: var(--text-muted); white-space: nowrap; min-width: 34px; text-align: center; }
.find-bar .icon-btn svg { width: 14px; height: 14px; }
/* Preview article */
.preview-article { width: 100%; max-width: var(--su-reading-width, 800px); margin: 0 auto; line-height: 1.7; font-size: 15px; color: var(--text); }
.preview-article h1, .preview-article h2, .preview-article h3, .preview-article h4, .preview-article h5, .preview-article h6 { color: var(--text); line-height: 1.3; margin-top: 1.4em; margin-bottom: .5em; position: relative; }
.preview-article > :is(h1, h2, h3):first-child, .preview-article :not(.su-block) > :is(h1, h2, h3):first-child, .preview-article > .su-block:first-child > :is(h1, h2, h3) { margin-top: 0; }
.preview-article h1 { font-size: 1.9em; border-bottom: 1px solid var(--border); padding-bottom: .3em; }
.preview-article h2 { font-size: 1.45em; border-bottom: 1px solid var(--border); padding-bottom: .25em; }
.preview-article h3 { font-size: 1.2em; }
.preview-article h4 { font-size: 1.05em; }
.preview-article p { margin: 0 0 14px; }
.preview-article a { color: var(--primary); text-decoration: none; }
.preview-article a:hover { text-decoration: underline; }
.preview-article .su-anchor { opacity: 0; margin-left: .35em; color: var(--text-muted); text-decoration: none; font-weight: 400; }
.preview-article :is(h1,h2,h3,h4,h5,h6):hover .su-anchor { opacity: 1; }
.preview-article img { max-width: 100%; border-radius: 8px; margin: 4px 0; }
.preview-article blockquote { border-left: 4px solid var(--bq-border); margin: 0 0 14px; padding: 8px 16px; background: var(--bq-bg); border-radius: 0 8px 8px 0; color: var(--bq-text); }
.preview-article blockquote p:last-child { margin-bottom: 0; }
.preview-article pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow-x: auto; margin: 0 0 14px; font-size: 13px; line-height: 1.5; position: relative; }
.preview-article pre[data-lang] { padding-top: 36px; }
.preview-article pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 0; left: 0; right: 0; padding: 6px 12px; font: 600 10px/1 var(--font); color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); background: var(--surface-hover); border-radius: 8px 8px 0 0; }
.preview-article code { font-family: var(--mono); }
.preview-article :not(pre) > code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; font-size: .88em; border: 1px solid var(--border); }
.preview-article table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 14px; }
.preview-article th, .preview-article td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.preview-article th { background: var(--surface-hover); font-weight: 600; color: var(--text); }
.preview-article tr:nth-child(even) { background: var(--surface-hover); }
.preview-article .mdp-table-wrap { overflow-x: auto; margin: 0 0 14px; }
.preview-article .mdp-table-wrap table { margin: 0; }
.preview-article ul, .preview-article ol { margin: 0 0 14px; padding-left: 26px; }
.preview-article li { margin: 3px 0; }
.preview-article li > ul, .preview-article li > ol { margin-bottom: 0; }
.preview-article hr { border: none; height: 2px; background: var(--border); margin: 24px 0; }
.preview-article li input[type="checkbox"] { margin-right: 6px; }
.preview-article del { color: var(--text-muted); }
/* ==highlight== */
.preview-article .su-hl { background: var(--hl-bg); color: var(--hl-text); padding: 0 3px; border-radius: 3px; }
.preview-article .su-hl code { background: transparent; color: inherit; }
/* Block editing */
#previewScroll { position: relative; }
.preview-article li input[type="checkbox"]:enabled { cursor: pointer; accent-color: var(--primary); }
.preview-article li.su-checked > :is(p, input) ~ *:not(ul, ol), .preview-article li.su-checked { color: var(--text-muted); }
.preview-article .su-done > :is(h1, h2, h3, h4, h5, h6) { cursor: pointer; color: var(--text-muted); }
.preview-article .su-done > :is(h1, h2, h3, h4, h5, h6)::before { content: '\25B8\00A0'; font-size: .8em; }
.preview-article .su-done.su-expanded > :is(h1, h2, h3, h4, h5, h6)::before { content: '\25BE\00A0'; }
.preview-article .su-collapsed, .preview-article.su-hide-done :is(.su-done-section, li.su-checked), .su-copying .su-anchor { display: none; }
.block-handle { position: absolute; z-index: 5; display: flex; gap: 2px; padding-top: 2px; }
.block-handle[hidden], .block-menu[hidden], .block-menu [hidden], .block-drop-line[hidden], .format-bar[hidden], #toastAction[hidden] { display: none; }
#blockGripBtn { cursor: grab; touch-action: none; }
.block-drop-line { position: absolute; z-index: 5; height: 2px; border-radius: 1px; background: var(--primary); pointer-events: none; }
.preview-article .su-dragging { opacity: .4; }
.format-bar { position: fixed; z-index: 150; display: flex; gap: 2px; min-width: 0; padding: 4px; }
.format-bar button { min-width: 28px; height: 28px; padding: 0 6px; border: none; border-radius: 6px; background: none; color: var(--text); font: 14px var(--font); cursor: pointer; }
.format-bar button:hover { background: var(--surface-hover); }
.format-bar mark { background: var(--hl-bg); color: var(--hl-text); padding: 0 3px; border-radius: 3px; }
.format-bar code { font: 12px var(--mono); }
.format-bar button svg { vertical-align: middle; }
.format-sep { width: 1px; margin: 4px 2px; background: var(--border); }
.format-sep[hidden] { display: none; }
.block-handle button { width: 22px; height: 22px; padding: 3px; border: none; border-radius: 4px; background: none; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.block-handle button:hover, .block-handle button[aria-expanded="true"] { background: var(--surface-hover); color: var(--text); }
.block-handle button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.block-handle svg { width: 16px; height: 16px; }
.block-menu { position: fixed; z-index: 150; min-width: 170px; }
.block-menu .block-menu-danger { color: #ff7b72; }
[data-theme="light"] .block-menu .block-menu-danger { color: #cf222e; }
.su-block-editor { margin: 0 0 14px; border: 1px solid var(--primary); border-radius: 8px; overflow: hidden; background: var(--code-bg); }
.su-block-editor .cm-editor { height: auto; }
.su-block-editor .cm-gutters { display: none; }
.su-block-editor .editor-fallback { display: block; height: auto; min-height: 3em; background: var(--code-bg); }
.save-state { font: 11px var(--mono); color: var(--text-muted); white-space: nowrap; }
.save-state.su-warn { color: #d29922; }
.doc-title[contenteditable="plaintext-only"] { cursor: text; padding: 1px 5px; margin: 0 -5px; border-radius: 4px; }
.doc-title[contenteditable="plaintext-only"]:hover { background: var(--surface-hover); }
.doc-title:focus { outline: 1px solid var(--primary); text-overflow: clip; }
/* Review comments */
::highlight(su-comment) { background-color: rgba(254, 208, 71, 0.2); }
::highlight(su-comment-active) { background-color: rgba(254, 208, 71, 0.42); }
[data-theme="light"] ::highlight(su-comment) { background-color: rgba(234, 179, 8, 0.22); }
[data-theme="light"] ::highlight(su-comment-active) { background-color: rgba(234, 179, 8, 0.48); }
.icon-btn[hidden] { display: none; }
.comments-btn { gap: 4px; font: 11px var(--mono); }
.comments-btn svg { display: none; }
.comments-btn[data-mode="expanded"] .i-expanded, .comments-btn[data-mode="collapsed"] .i-collapsed, .comments-btn[data-mode="hidden"] .i-hidden { display: block; }
#previewArticle { grid-area: 1 / 1; }
#commentsRail { display: none; grid-area: 1 / 2; align-self: stretch; position: relative; }
body.su-has-comments:not(.su-rail-hidden) #previewScroll { display: grid; grid-template-columns: minmax(0, var(--su-reading-track, 800px)) var(--su-rail-w, 320px); justify-content: center; column-gap: 48px; align-items: start; }
body.su-has-comments:not(.su-rail-hidden) #commentsRail { display: block; }
body.su-rail-wide { --su-rail-w: min(62vw, 1000px); }
.cm-resizer { position: absolute; top: 0; bottom: 0; left: -30px; width: 12px; cursor: col-resize; touch-action: none; }
.cm-resizer::after { content: ''; position: absolute; inset: 0 5px; border-radius: 1px; background: var(--primary); opacity: 0; transition: opacity .15s; }
.cm-resizer:hover::after, .cm-resizer:active::after { opacity: .7; }
.cm-card { position: absolute; left: 0; right: 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; line-height: 1.5; transition: top .18s ease, transform .18s ease, box-shadow .18s ease, border-color .15s; }
.cm-card:hover { border-color: var(--text-muted); }
.cm-card.active { z-index: 1; transform: translateX(-10px); border-color: var(--primary); box-shadow: 0 10px 28px rgba(0,0,0,0.3); }
.cm-card.resolved:not(.active) { opacity: .7; }
.cm-card.collapsed { padding-block: 6px; }
.cm-card.collapsed > :not(.cm-head) { display: none; }
.cm-head { display: flex; align-items: center; gap: 2px; margin-bottom: 8px; }
.cm-card.collapsed .cm-head { margin-bottom: 0; }
.cm-summary { display: none; flex: none; align-items: center; }
.cm-card.collapsed .cm-summary { display: flex; }
.cm-card.collapsed:not(:hover, :focus-within) .cm-head :is(.icon-btn, .cm-tag), .cm-card.collapsed:is(:hover, :focus-within) .cm-summary { display: none; }
.cm-summary .cm-avatar { width: 18px; height: 18px; font-size: 8px; box-shadow: 0 0 0 2px var(--surface); }
.cm-summary .cm-avatar + .cm-avatar { margin-left: -5px; }
.cm-count { margin-left: 5px; color: var(--text-muted); font: 11px var(--mono); }
.cm-quote { flex: 1; min-width: 0; margin-right: 4px; padding: 0 0 0 8px; border: none; border-left: 2px solid var(--primary); background: none; color: var(--text-muted); font: italic 12px/1.5 var(--font); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cm-quote:hover { color: var(--text); }
.cm-card.orphan .cm-quote { border-left-color: var(--border); text-decoration: line-through; }
.cm-tag { font: 600 10px/1 var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-right: 4px; }
.cm-head .icon-btn svg { width: 14px; height: 14px; }
.cm-head .icon-btn { opacity: 0; }
.cm-card:is(:hover, .active, :focus-within) .cm-head .icon-btn { opacity: 1; }
.cm-widen .i-narrow, body.su-rail-wide .cm-widen .i-widen { display: none; }
body.su-rail-wide .cm-widen .i-narrow { display: block; }
.cm-comment + .cm-comment { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.cm-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cm-avatar { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: hsl(var(--hue) 55% 42%); color: #fff; font: 600 10px/1 var(--font); }
.cm-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-time { flex: none; color: var(--text-muted); font-size: 11px; }
.cm-actions { margin-left: auto; display: flex; opacity: 0; }
.cm-comment:is(:hover, :focus-within) .cm-actions { opacity: 1; }
.cm-actions button { padding: 2px 5px; border: none; border-radius: 4px; background: none; color: var(--text-muted); font: 11px var(--font); cursor: pointer; }
.cm-actions button:hover { color: var(--text); background: var(--surface-hover); }
.cm-body.preview-article { margin-top: 6px; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.cm-body.preview-article :is(p, ul, ol, pre, blockquote, table, .markdown-alert, .su-diagram, .su-mermaid) { margin-bottom: 8px; }
.cm-body.preview-article > :last-child { margin-bottom: 0 !important; }
.cm-body.preview-article :is(h1, h2, h3, h4, h5, h6) { margin: .6em 0 .3em; padding: 0; border: none; font-size: 1.05em; }
.cm-body .su-diagram .su-diagram-view { aspect-ratio: 4 / 3; }
.cm-body .su-diagram:not(:hover, :focus-within, :fullscreen) .su-diagram-controls { visibility: hidden; }
.cm-body .su-diagram-modes button { padding: 0 6px; font-size: 11px; }
.cm-composer { margin-top: 10px; }
.cm-head + .cm-composer { margin-top: 0; }
.cm-comment .cm-composer { margin-top: 6px; }
.cm-composer textarea { display: block; width: 100%; min-height: 34px; padding: 7px 9px; resize: none; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: 13px/1.5 var(--font); outline: none; }
.cm-composer textarea:focus { border-color: var(--primary); }
.cm-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.cm-card:not(.draft) .cm-composer:not(:focus-within):has(textarea:placeholder-shown) .cm-foot { display: none; }
.cm-composer[data-edit] .cm-foot > :is(.cm-avatar, .cm-author) { visibility: hidden; }
.cm-author { flex: 1; min-width: 0; padding: 3px 5px; border: none; border-radius: 4px; background: none; color: var(--text-muted); font: 12px var(--font); outline: none; }
.cm-author:is(:hover, :focus) { background: var(--surface-hover); color: var(--text); }
@media (max-width: 900px) {
body.su-has-comments:not(.su-rail-hidden) #previewScroll { grid-template-columns: minmax(0, 1fr); }
#commentsRail { grid-area: 2 / 1; margin-top: 24px; }
.cm-card { position: static; margin-bottom: 10px; }
.cm-card.active { transform: none; }
.cm-resizer { display: none; }
}
/* find-in-page hits */
.preview-article .find-hit { background: rgba(254, 208, 71, 0.35); border-radius: 2px; }
.preview-article .find-hit.current { background: var(--primary); color: var(--primary-text); }
/* KaTeX */
.preview-article .katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.preview-article .su-math-error { color: #cf222e; font-family: var(--mono); font-size: .9em; }
[data-theme="dark"] .preview-article .su-math-error { color: #ff7b72; }
/* GitHub-style alerts */
.preview-article .markdown-alert { margin: 0 0 14px; padding: 8px 16px; border-left: 4px solid var(--border); border-radius: 0 8px 8px 0; background: var(--bq-bg); color: var(--text); }
.preview-article .markdown-alert > p { margin: 0 0 8px; }
.preview-article .markdown-alert > p:last-child { margin-bottom: 0; }
.preview-article .markdown-alert-title { display: flex; align-items: center; gap: 6px; font-weight: 600; margin: 0 0 6px; }
.preview-article .markdown-alert-note { border-left-color: #1f6feb; } .preview-article .markdown-alert-note .markdown-alert-title { color: #1f6feb; }
.preview-article .markdown-alert-tip { border-left-color: #2da44e; } .preview-article .markdown-alert-tip .markdown-alert-title { color: #2da44e; }
.preview-article .markdown-alert-important { border-left-color: #8957e5; } .preview-article .markdown-alert-important .markdown-alert-title { color: #8957e5; }
.preview-article .markdown-alert-warning { border-left-color: #d29922; } .preview-article .markdown-alert-warning .markdown-alert-title { color: #d29922; }
.preview-article .markdown-alert-caution { border-left-color: #cf222e; } .preview-article .markdown-alert-caution .markdown-alert-title { color: #cf222e; }
/* Mermaid: render into a light figure card so it stays legible in any theme. */
.preview-article .su-mermaid { margin: 0 0 14px; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: 8px; text-align: center; overflow-x: auto; }
.preview-article .su-mermaid svg { max-width: 100%; height: auto; }
.su-diagram { position: relative; margin: 0 0 16px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; color: #343741; }
.su-diagram .su-diagram-view { display: block; width: 100%; height: auto; aspect-ratio: 2; background: #eef3f8; touch-action: none; cursor: grab; }
.su-diagram .su-diagram-view:active { cursor: grabbing; }
.su-diagram .su-diagram-view:focus-visible { outline: 2px solid #2674bf; outline-offset: -3px; }
.su-diagram .su-stl-snapshot { display: none; }
@media print { .su-diagram canvas.su-diagram-view { display: none; } .su-diagram .su-stl-snapshot { display: block; width: 100%; } }
.su-diagram:fullscreen { display: flex; flex-direction: column; border: none; border-radius: 0; }
.su-diagram:fullscreen .su-diagram-view { flex: 1; min-height: 0; height: calc(100dvh - 34px); aspect-ratio: auto; }
.su-diagram figcaption { padding: 8px 12px; font: 12px/1.5 var(--font, system-ui); }
.su-diagram-controls { position: absolute; inset: 10px 10px 44px; pointer-events: none; }
.su-diagram:is([data-kind="stl"], [data-kind="su-mesh"]) .su-diagram-controls { bottom: 10px; }
.su-diagram-controls button { display: inline-flex; align-items: center; justify-content: center; height: 30px; min-width: 30px; padding: 0 9px; border: 1px solid #58616e; border-radius: 5px; background: #242c37; color: #fff; font: 12px/1.4 system-ui; cursor: pointer; pointer-events: auto; box-shadow: 0 2px 5px #0002; }
.su-diagram-controls button:hover, .su-diagram-controls button[aria-pressed="true"] { background: #43516a; }
.su-diagram-controls button:focus-visible { outline: 2px solid #2674bf; outline-offset: 2px; }
.su-diagram-controls button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.su-diagram-actions, .su-diagram-modes, .su-diagram-navigation, .su-diagram-rotation { position: absolute; display: flex; gap: 4px; pointer-events: none; }
.su-diagram-actions { top: 0; right: 0; }
.su-diagram-modes { top: 0; left: 0; gap: 0; }
.su-diagram-modes button { border-radius: 0; box-shadow: none; }
.su-diagram-modes button + button { border-left: none; }
.su-diagram-modes button:first-child { border-radius: 5px 0 0 5px; }
.su-diagram-modes button:last-child { border-radius: 0 5px 5px 0; }
.su-diagram-navigation { bottom: 0; right: 0; }
.su-diagram-navigation:has(.su-diagram-pan), .su-diagram-rotation { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(3, 30px); gap: 3px; }
.su-diagram-pan { display: contents; }
.su-diagram-navigation:has(.su-diagram-pan) > button, .su-diagram-rotation button, .su-diagram-pan button { width: 30px; min-width: 0; padding: 0; }
.su-diagram-controls [aria-label="Pan up"], .su-diagram-controls [aria-label="Rotate up"] { grid-area: 1 / 2; }
.su-diagram-controls [aria-label="Pan left"], .su-diagram-controls [aria-label="Rotate left"] { grid-area: 2 / 1; }
.su-diagram-controls [aria-label="Pan right"], .su-diagram-controls [aria-label="Rotate right"] { grid-area: 2 / 3; }
.su-diagram-controls [aria-label="Pan down"], .su-diagram-controls [aria-label="Rotate down"] { grid-area: 3 / 2; }
.su-diagram-navigation:has(.su-diagram-pan) [aria-label="Reset view"], .su-diagram-controls [aria-label="Reset rotation"] { grid-area: 2 / 2; }
.su-diagram-navigation:has(.su-diagram-pan) [aria-label="Zoom in"] { grid-area: 1 / 3; }
.su-diagram-navigation:has(.su-diagram-pan) [aria-label="Zoom out"] { grid-area: 3 / 3; }
.su-diagram-rotation { bottom: 0; left: 0; }
.su-diagram-status { position: absolute; top: 48px; right: 10px; background: #242c37; color: #fff; padding: 5px 9px; border-radius: 5px; font: 12px system-ui; }
.su-diagram-attribution { fill: #343741; font: 10px system-ui; }
@media (max-width: 480px) { .su-diagram-modes button { font-size: 10px; padding: 0 5px; } .su-diagram-controls { inset: 6px 6px 44px; } }
@media (max-width: 480px) { .su-diagram:is([data-kind="stl"], [data-kind="su-mesh"]) .su-diagram-controls { bottom: 6px; } }
.su-diagram details { padding: 0 12px 8px; }
.su-diagram summary { cursor: pointer; font: 12px/1.5 system-ui; }
.su-diagram details pre { max-height: 240px; margin-top: 8px; }
@media print { .su-diagram-controls, .su-diagram details { display: none !important; } }
.preview-article .su-mermaid-error { margin: 0 0 14px; padding: 12px 16px; background: var(--bq-bg); border: 1px solid var(--bq-border); border-left-width: 4px; border-radius: 0 8px 8px 0; }
.preview-article .su-mermaid-error-title { margin: 0 0 8px; font-weight: 600; color: var(--text); }
.preview-article .su-mermaid-error pre { margin: 8px 0 0; padding: 8px 10px; }
.preview-article .su-mermaid-error-msg { color: #cf222e; }
[data-theme="dark"] .preview-article .su-mermaid-error-msg { color: #ff7b72; }
/* Loading state (fragment / ?url= hydration) */
.loading-state { min-height: 320px; height: 100%; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text-muted); padding: 40px; text-align: center; }
.loading-state svg { width: 28px; height: 28px; animation: su-spin-edit 1s linear infinite; }
.loading-state .loading-text { font-size: 13px; }
html.su-loading #loadingState { display: flex; }
html.su-loading #emptyState { display: none; }
/* Empty / start state */
.empty-state { min-height: 320px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); padding: 40px; text-align: center; }
.empty-state-icon { width: 56px; height: 56px; margin-bottom: 16px; border-radius: 14px; background: var(--surface-hover); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.empty-state-icon svg { width: 28px; height: 28px; stroke: currentColor; fill: none; }
.empty-state-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.empty-state-sub { font-size: 13px; margin-bottom: 18px; max-width: 420px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.url-form { display: flex; gap: 8px; width: 100%; max-width: 460px; align-items: stretch; }
.url-form input { flex: 1; min-width: 0; padding: 0 10px; height: 24px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 12px var(--font); outline: none; }
.url-form .btn-sm { flex: none; }
.url-form input:focus { border-color: var(--text-muted); }
/* Export dropdown */
.export-anchor { position: relative; display: inline-flex; }
.export-anchor .chevron { margin-left: 2px; transition: transform .15s; }
.export-anchor:has(.export-menu:popover-open) .chevron,
#exportBtn[aria-expanded="true"] .chevron,
#shareBtn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.export-menu { margin: 0; min-width: 130px; max-width: calc(100vw - 24px); padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.export-item { display: block; width: 100%; padding: 7px 14px; border: none; background: transparent; color: var(--text); font: 13px var(--font); font-weight: 500; cursor: pointer; border-radius: 6px; text-align: left; transition: background .15s; }
.export-item + .export-item { margin-top: 2px; }
.export-item:hover, .export-item:focus-visible { background: var(--surface-hover); outline: none; }
.share-menu { min-width: 290px; }
.export-item .item-sub { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.export-item:disabled { cursor: not-allowed; opacity: .55; background: transparent; }
.export-item[hidden] { display: none; }
.share-danger { color: #ff7b72; }
[data-theme="light"] .share-danger { color: #cf222e; }
.share-ttl { display: flex; gap: 6px; margin: 8px 0 6px; padding: 0 14px; }
.share-ttl[hidden] { display: none; }
.share-ttl button { flex: 1; padding: 3px 0; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text-muted); font: 12px var(--font); cursor: pointer; }
.share-ttl button[aria-pressed="true"] { background: var(--surface-hover); border-color: var(--text-muted); color: var(--text); }
.share-ttl button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.short-link-alert { max-width: 460px; margin-bottom: 18px; padding: 10px 14px; border: 1px solid #d29922; border-radius: 8px; background: rgba(210,153,34,0.1); color: var(--text); font-size: 13px; }
.short-link-alert[hidden] { display: none; }
/* Options popover */
.options-anchor { position: relative; display: inline-flex; }
.options-popover { margin: 0; min-width: 260px; max-width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - 72px); overflow-y: auto; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.options-popover h4 { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }
.options-popover h4:not(:first-child) { margin-top: 16px; }
.options-popover label { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 13px; color: var(--text); line-height: 1.4; }
.options-popover .width-label { display: block; padding: 0 0 6px; font-weight: 600; }
.options-popover .width-custom { display: block; margin-top: 6px; }
.options-popover .width-custom[hidden] { display: none; }
.options-popover select, .options-popover input[type="number"] { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: 13px var(--font); }
.options-popover :is(select, input[type="number"]):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.options-popover input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; margin-top: 2px; flex-shrink: 0; }
.options-popover .opt-desc { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.options-popover .opt-desc code { font-family: var(--mono); font-size: 10px; background: var(--surface-hover); padding: 0 4px; border-radius: 3px; }
/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--surface); color: var(--text); padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; z-index: 200; box-shadow: 0 4px 12px rgba(0,0,0,0.3); display: flex; align-items: center; gap: 8px; animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes su-spin-edit { to { transform: rotate(360deg); } }
#fileInput, #modelImportStatus[hidden] { display: none; }
.su-footer { text-align: center; padding: 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.8rem; transition: border-color .25s, color .25s; }
.su-footer p { margin: 0; }
.su-footer-fineprint { margin-top: 6px !important; font-size: 0.7rem; opacity: 0.75; }
.su-footer-link { background: none; border: none; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.su-footer-link:hover { color: var(--text); }
.su-dialog { max-width: 520px; width: calc(100% - 32px); max-height: calc(100% - 32px); inset: 0; margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.su-dialog::backdrop { background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); }
.su-dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.su-dialog-header h2 { font-size: 1rem; font-weight: 600; }
.su-dialog-close { width: 28px; height: 28px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: all .15s; }
.su-dialog-close:hover { background: var(--surface-hover); color: var(--text); }
.su-dialog-body { padding: 16px 18px; font-size: 0.875rem; line-height: 1.55; color: var(--text); }
.su-dialog-body p { margin-bottom: 12px; }
.su-dialog-body p:last-child { margin-bottom: 0; }
.su-dialog-body code { font-family: var(--mono); background: var(--surface-hover); padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }
.su-dialog-body a { color: var(--primary); text-decoration: none; }
.su-dialog-body a:hover { text-decoration: underline; }
.su-dialog-fineprint { font-size: 0.8rem; color: var(--text-muted); }
.page-title, .panel-label, .su-dialog-header h2, .card-header { text-wrap: balance; }
.su-dialog-body p, .su-more-tools p, .tool-desc, .empty-state-sub { text-wrap: pretty; }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
.su-credits-list { margin: 0 0 12px; padding-left: 20px; }
.su-credits-list li { margin-bottom: 6px; }
.su-credits-list li:last-child { margin-bottom: 0; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
@media (max-width: 960px) { .stats-text { display: none; } }
@media (max-width: 880px) {
#optionsBtn .opt-label { display: none; }
#optionsBtn { padding: 4px 8px; }
.toolbar-actions { gap: 6px; }
}
@media (max-width: 768px) {
main { padding: 12px; }
.output-scroll { padding: 20px; }
.doc-title { max-width: 60vw; }
#exportBtn .btn-label, #shareBtn .btn-label { display: none; }
.view-btn { padding: 0 8px; }
.btn-sm { padding: 5px 9px; height: 23px; font-size: 11px; }
}
@media (max-width: 640px) {
header { padding: 0 12px; }
.logo-svg { height: 20px; }
.logo-badge { font-size: 11px; padding: 2px 7px; }
.btn { padding: 6px 10px; font-size: 12px; }
}
</style>
</head>
<body>
<noscript>
<p class="su-noscript"><strong>Markdown Preview</strong> — Preview Markdown with Mermaid diagrams, GeoJSON/TopoJSON maps, ASCII STL models, math, alerts, and HTML/PDF export. Requires JavaScript; please enable it. Source on <a href="https://github.com/secutils-dev/secutils/blob/main/dev/tools/md.html">GitHub</a>.</p>
</noscript>
<header>
<a class="logo" href="https://secutils.dev" target="_blank" rel="noopener">
<svg class="logo-svg" height="24" role="img" viewBox="0 0 98 16" xmlns="http://www.w3.org/2000/svg">
<path d="m3 0h10c1.662 0 3 1.338 3 3v10c0 1.662-1.338 3-3 3h-10c-1.662 0-3-1.338-3-3v-10c0-1.662 1.338-3 3-3z" fill="#fed047"/>
<path aria-label="SU" d="m11.285 12q-1.12 0-1.728-0.608-0.608-0.61867-0.608-1.6747v-5.6107h1.152v5.6q0 0.59733 0.29867 0.93867 0.29867 0.34133 0.88534 0.34133 0.58667 0 0.88534-0.34133 0.29867-0.34134 0.29867-0.93867v-5.6h1.152v5.6107q0 1.0667-0.608 1.6747t-1.728 0.608zm-6.368 0q-1.152 0-1.8453-0.608-0.69334-0.608-0.69334-1.664h1.1307q0 0.58667 0.384 0.928 0.384 0.33067 1.024 0.33067 0.62934 0 0.992-0.34133 0.36267-0.34134 0.36267-0.90667 0-0.42667-0.23467-0.74667t-0.672-0.43733l-1.12-0.29867q-0.78934-0.21333-1.248-0.77867-0.448-0.56534-0.448-1.3547 0-0.64 0.27733-1.1093 0.288-0.48 0.81067-0.74667t1.216-0.26667 1.216 0.26667q0.53334 0.26667 0.82134 0.74667 0.29867 0.46933 0.29867 1.0987h-1.1307q0-0.50133-0.34133-0.8-0.33067-0.30933-0.864-0.30933t-0.864 0.30933q-0.32 0.29867-0.32 0.78934 0 0.39467 0.21333 0.66134 0.224 0.26667 0.61867 0.37333l1.152 0.30933q0.81067 0.21333 1.28 0.832t0.46933 1.4613q0 0.69334-0.30933 1.2053-0.30933 0.50133-0.864 0.77867-0.55467 0.27733-1.312 0.27733z" fill="#642340"/>
<path class="logo-text-fill" aria-label="SECUTILS.DEV" d="m93.158 12.117-1.9733-7.7867h1.1733l1.2587 5.184q0.11733 0.46933 0.20267 0.91734 0.08533 0.448 0.128 0.69334 0.04267-0.24533 0.128-0.69334 0.096-0.45867 0.21333-0.928l1.2053-5.1733h1.184l-1.984 7.7867zm-7.8294 0v-7.7867h4.576v1.024h-3.4453v2.2187h3.072v0.992h-3.072v2.528h3.4453v1.024zm-6.5174 0v-7.7867h2.176q0.768 0 1.3333 0.29867 0.56534 0.288 0.87467 0.832 0.32 0.53334 0.32 1.248v3.008q0 0.736-0.32 1.2693-0.30933 0.53334-0.87467 0.832-0.56534 0.29867-1.3333 0.29867zm1.152-1.0347h1.024q0.62934 0 1.0027-0.36267 0.37333-0.36267 0.37333-1.0027v-3.008q0-0.61867-0.37333-0.98134-0.37334-0.37333-1.0027-0.37333h-1.024zm-5.2374 1.1413q-0.416 0-0.68267-0.24533-0.256-0.256-0.256-0.672 0-0.416 0.256-0.672 0.26667-0.26667 0.68267-0.26667 0.416 0 0.672 0.26667 0.26667 0.256 0.26667 0.672 0 0.416-0.26667 0.672-0.256 0.24533-0.672 0.24533zm-6.368 0q-1.152 0-1.8453-0.608-0.69334-0.608-0.69334-1.664h1.1307q0 0.58667 0.384 0.928 0.384 0.33067 1.024 0.33067 0.62934 0 0.992-0.34133 0.36267-0.34134 0.36267-0.90667 0-0.42667-0.23467-0.74667t-0.672-0.43733l-1.12-0.29867q-0.78934-0.21333-1.248-0.77867-0.448-0.56534-0.448-1.3547 0-0.64 0.27733-1.1093 0.288-0.48 0.81067-0.74667 0.52267-0.26667 1.216-0.26667 0.69334 0 1.216 0.26667 0.53334 0.26667 0.82134 0.74667 0.29867 0.46933 0.29867 1.0987h-1.1307q0-0.50134-0.34133-0.8-0.33067-0.30933-0.864-0.30933t-0.864 0.30933q-0.32 0.29867-0.32 0.78934 0 0.39467 0.21333 0.66134 0.224 0.26667 0.61867 0.37333l1.152 0.30933q0.81067 0.21333 1.28 0.832 0.46934 0.61867 0.46934 1.4613 0 0.69334-0.30934 1.2053-0.30933 0.50134-0.864 0.77867-0.55467 0.27733-1.312 0.27733zm-8.288-0.10667v-7.7867h1.152v6.7414h3.4027v1.0453zm-6.6987 0v-1.0453h1.568v-5.696h-1.568v-1.0453h4.32v1.0453h-1.5787v5.696h1.5787v1.0453zm-4.8214 0v-6.7414h-2.08v-1.0453h5.3227v1.0453h-2.0907v6.7414zm-5.824 0.10667q-1.12 0-1.728-0.608-0.608-0.61867-0.608-1.6747v-5.6107h1.152v5.6q0 0.59733 0.29867 0.93867 0.29867 0.34133 0.88534 0.34133 0.58667 0 0.88534-0.34133 0.29867-0.34134 0.29867-0.93867v-5.6h1.152v5.6107q0 1.0667-0.608 1.6747t-1.728 0.608zm-6.3147 0q-1.0987 0-1.7493-0.608-0.64-0.61867-0.64-1.664v-3.456q0-1.056 0.64-1.664 0.65067-0.608 1.7493-0.608 1.088 0 1.728 0.61867 0.65067 0.608 0.65067 1.6533h-1.152q0-0.608-0.33067-0.928-0.32-0.32-0.896-0.32-0.58667 0-0.91734 0.32-0.32 0.32-0.32 0.928v3.456q0 0.608 0.32 0.928 0.33067 0.32 0.91734 0.32 0.576 0 0.896-0.32 0.33067-0.32 0.33067-0.928h1.152q0 1.0453-0.65067 1.664-0.64 0.608-1.728 0.608zm-8.6827-0.10667v-7.7867h4.576v1.024h-3.4453v2.2187h3.072v0.992h-3.072v2.528h3.4453v1.024zm-4.1707 0.10667q-1.152 0-1.8453-0.608-0.69334-0.608-0.69334-1.664h1.1307q0 0.58667 0.384 0.928 0.384 0.33067 1.024 0.33067 0.62934 0 0.992-0.34133 0.36267-0.34134 0.36267-0.90667 0-0.42667-0.23467-0.74667-0.23467-0.32-0.672-0.43733l-1.12-0.29867q-0.78934-0.21333-1.248-0.77867-0.448-0.56534-0.448-1.3547 0-0.64 0.27733-1.1093 0.288-0.48 0.81067-0.74667 0.52267-0.26667 1.216-0.26667 0.69334 0 1.216 0.26667 0.53334 0.26667 0.82134 0.74667 0.29867 0.46933 0.29867 1.0987h-1.1307q0-0.50134-0.34134-0.8-0.33067-0.30933-0.864-0.30933t-0.864 0.30933q-0.32 0.29867-0.32 0.78934 0 0.39467 0.21333 0.66134 0.224 0.26667 0.61867 0.37333l1.152 0.30933q0.81067 0.21333 1.28 0.832 0.46934 0.61867 0.46934 1.4613 0 0.69334-0.30934 1.2053-0.30933 0.50134-0.864 0.77867-0.55467 0.27733-1.312 0.27733z"/>
</svg>
<span class="logo-badge">Markdown Preview</span>
</a>
<div class="header-right">
<a id="skillLink" class="skill-link" href="#" target="_blank" rel="noopener"
title="View AI agent skill (skill.md, opens in new tab)"
aria-label="View AI agent skill (opens in new tab)">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.582a.5.5 0 0 1 0 .962L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>
<path d="M20 3v4"/><path d="M22 5h-4"/><path d="M4 17v2"/><path d="M5 18H3"/>
</svg>
<span>Skill</span>
</a>
<button class="theme-toggle" id="themeToggle" aria-label="Toggle theme">
<svg class="icon-sun" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M8.5 15h-1v-2h1v2Zm-3.674-3.107-1.414 1.414-.707-.707 1.414-1.415.707.708Zm8.479.707-.707.707-1.414-1.414.707-.708 1.414 1.415Z"/><path fill-rule="evenodd" d="M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z" clip-rule="evenodd"/><path d="M3.005 8.505h-2v-1h2v1Zm12 0h-2v-1h2v1ZM4.82 4.114l-.708.707-1.414-1.414.707-.707L4.82 4.114Zm8.492-.707-1.414 1.414-.708-.707L12.605 2.7l.707.707ZM8.5 3h-1V1h1v2Z"/></svg>
<svg class="icon-moon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M4.05 12.95A6.982 6.982 0 0 1 2 8c0-1.79.684-3.583 2.05-4.95A6.982 6.982 0 0 1 9 1a1 1 0 0 1 .708 1.707 4.982 4.982 0 0 0-1.465 3.536 4.98 4.98 0 0 0 1.465 3.535 4.98 4.98 0 0 0 3.535 1.465 1 1 0 0 1 .707 1.707A6.981 6.981 0 0 1 9 15a6.983 6.983 0 0 1-4.95-2.05Zm.708-.707A5.983 5.983 0 0 0 9 14c1.535 0 3.07-.586 4.242-1.757a5.98 5.98 0 0 1-4.018-1.545L9 10.485a5.982 5.982 0 0 1-1.758-4.242A5.986 5.986 0 0 1 9 2a5.983 5.983 0 0 0-4.243 1.757A5.98 5.98 0 0 0 3 8l.006.288a5.978 5.978 0 0 0 1.75 3.955Z"/></svg>
</button>
</div>
</header>
<main>
<div class="toolbar">
<div class="toolbar-left">
<span id="docTitle" class="doc-title" spellcheck="false" title="Rename">Markdown Preview</span>
<span id="docStats" class="stats-text">empty</span>
<span id="saveState" class="save-state" role="status" aria-live="polite"></span>
</div>
<div class="toolbar-actions">
<button id="openBtn" class="btn btn-sm" title="Open a Markdown, STL, or 3MF file (Ctrl/Cmd+O)">
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6A2 2 0 0 1 18.45 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/></svg>
<span class="btn-label">Open</span>
</button>
<div class="view-switch" role="group" aria-label="View mode">
<button type="button" class="view-btn active" id="viewPreviewBtn" data-view="preview" aria-pressed="true" title="Rendered preview">Preview</button>
<button type="button" class="view-btn" id="viewHtmlBtn" data-view="html" aria-pressed="false" disabled title="Preview the exported self-contained HTML">HTML</button>
<button type="button" class="view-btn" id="viewEditBtn" data-view="edit" aria-pressed="false" title="Edit the Markdown source (Ctrl/Cmd+E)">Source</button>
</div>
<button id="commentsBtn" class="icon-btn comments-btn" hidden data-mode="expanded" aria-label="Comments">
<svg class="i-expanded" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/><path d="M7 8h10M7 12h6"/></svg>
<svg class="i-collapsed" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
<svg class="i-hidden" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15V5a2 2 0 0 0-2-2H9"/><path d="m2 2 20 20"/><path d="M3.6 3.6A2 2 0 0 0 3 5v16l4-4h10"/></svg>
<span id="commentsCount"></span>
</button>
<button id="findBtn" class="icon-btn" title="Find in document (Ctrl/Cmd+F)" aria-label="Find in document">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
</button>
<div class="options-anchor">
<button id="optionsBtn" class="btn btn-sm" commandfor="optionsPopover" command="toggle-popover" aria-haspopup="true" title="Document options">
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"/></svg>
<span class="opt-label">Options</span>
</button>
<div id="optionsPopover" popover class="options-popover" role="dialog" aria-label="Document options">
<h4>Reading layout</h4>
<label class="width-label" for="optReadingWidth">Reading width</label>
<select id="optReadingWidth">
<option value="800">Comfortable (800px)</option>
<option value="1100">Wide (1100px)</option>
<option value="full">Full width</option>
<option value="custom">Custom</option>
</select>
<label class="width-custom" id="optReadingCustomWrap" for="optReadingCustom" hidden>Custom width (px)
<input type="number" id="optReadingCustom" min="320" max="2400" step="1" value="800" inputmode="numeric">
</label>
<h4>Editing</h4>
<label>
<input type="checkbox" id="optHideDone">
<span>Hide done items
<span class="opt-desc">Hides checked tasks and sections whose heading is struck through.</span>
</span>
</label>
<h4>Exported HTML features</h4>
<label>
<input type="checkbox" id="optToc" checked>
<span>Table of contents
<span class="opt-desc">Floating sidebar generated from h2/h3 headings.</span>
</span>
</label>
<label>
<input type="checkbox" id="optPdf" checked>
<span>PDF export
<span class="opt-desc">Adds a button to save the page as a PDF.</span>
</span>
</label>
<label>
<input type="checkbox" id="optFind" checked>
<span>Find in page
<span class="opt-desc">Adds a search button (Ctrl/Cmd+F) to find text within the page.</span>
</span>
</label>
<label>
<input type="checkbox" id="optSource">
<span>Embed Markdown source
<span class="opt-desc">Embedded as <code><script type="text/markdown"></code>.</span>
</span>
</label>
</div>
</div>
<div class="export-anchor">
<button id="exportBtn" class="btn btn-sm" disabled commandfor="exportMenu" command="toggle-popover" aria-haspopup="menu" title="Export the document">
<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v9"/><path d="M4.5 7.5 8 11l3.5-3.5"/><path d="M3 13.5h10"/></svg>
<span class="btn-label">Export</span>
<svg class="chevron" viewBox="0 0 12 12" width="10" height="10" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m3 5 3 3 3-3"/></svg>
</button>
<div id="exportMenu" popover class="export-menu" role="menu" aria-label="Export menu">
<button class="export-item" role="menuitem" id="exportHtmlBtn">Download HTML</button>
<button class="export-item" role="menuitem" id="exportPdfBtn">Download PDF</button>
<button class="export-item" role="menuitem" id="copyHtmlBtn">Copy HTML</button>
</div>
</div>
<div class="export-anchor">
<button id="shareBtn" class="btn btn-primary btn-sm" disabled commandfor="shareMenu" command="toggle-popover" aria-haspopup="menu" title="Copy a link to this document">
<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="3.5" r="2"/><circle cx="4" cy="8" r="2"/><circle cx="12" cy="12.5" r="2"/><path d="M5.7 7 10.3 4.5M5.7 9l4.6 2.5"/></svg>
<span class="btn-label">Share</span>
<svg class="chevron" viewBox="0 0 12 12" width="10" height="10" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m3 5 3 3 3-3"/></svg>
</button>
<div id="shareMenu" popover class="export-menu share-menu" role="menu" aria-label="Share menu">
<button class="export-item" role="menuitem" id="copyFullLinkBtn">Copy full link<span class="item-sub" id="fullLinkSub">Never expires · whole document in the URL</span></button>
<button class="export-item" role="menuitem" id="copyShortLinkBtn">Copy short link<span class="item-sub" id="shortLinkSub">Encrypted copy stored on Secutils.dev</span></button>
<div class="share-ttl" id="shortTtl" role="group" aria-label="Short link lifetime">
<button type="button" data-ttl="86400" aria-pressed="false">1 day</button>
<button type="button" data-ttl="604800" aria-pressed="true">7 days</button>
<button type="button" data-ttl="1209600" aria-pressed="false">14 days</button>
</div>
<button class="export-item share-danger" role="menuitem" id="deleteShortLinkBtn" hidden>Delete short link</button>
</div>
</div>
<button id="fullscreenBtn" class="icon-btn" title="Toggle fullscreen" aria-label="Toggle fullscreen">
<svg id="fullscreenEnterIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>
<svg id="fullscreenExitIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:none"><path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"/></svg>
</button>
</div>
</div>
<div id="previewPane">
<div class="output-panel" id="previewWrap">
<div id="previewScroll" class="output-scroll">
<article id="previewArticle" class="preview-article"></article>
<aside id="commentsRail" aria-label="Comments">
<div id="railResizer" class="cm-resizer" role="separator" aria-orientation="vertical" title="Drag to resize comments. Double-click to widen."></div>
</aside>
<div id="blockHandle" class="block-handle" hidden>
<button id="blockAddBtn" type="button" title="Add a block below" aria-label="Add a block below">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M8 3v10M3 8h10"/></svg>
</button>
<button id="blockGripBtn" type="button" title="Block actions (double-click a block to edit)" aria-label="Block actions" aria-haspopup="menu" aria-expanded="false">
<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><circle cx="6" cy="4" r="1.2"/><circle cx="10" cy="4" r="1.2"/><circle cx="6" cy="8" r="1.2"/><circle cx="10" cy="8" r="1.2"/><circle cx="6" cy="12" r="1.2"/><circle cx="10" cy="12" r="1.2"/></svg>
</button>
</div>
<div id="blockDropLine" class="block-drop-line" hidden></div>
<div id="loadingState" class="loading-state" aria-live="polite">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><circle cx="12" cy="12" r="9" opacity=".25"/><path d="M21 12a9 9 0 0 1-9 9" stroke-linecap="round"/></svg>
<span class="loading-text">Loading Markdown…</span>
</div>
<div id="emptyState" class="empty-state">
<div id="shortLinkAlert" class="short-link-alert" role="alert" hidden>This short link has expired or doesn't exist. Ask the sender for a new one.</div>
<div class="empty-state-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/><path d="M9 13h6"/><path d="M9 17h6"/></svg>
</div>
<div class="empty-state-title">Preview any Markdown</div>
<div class="empty-state-sub">Open or drop a Markdown, STL, or 3MF file, paste (Ctrl/Cmd+V), load the example, or fetch from a public URL.</div>
<div class="empty-actions">
<button id="emptyOpenBtn" class="btn btn-primary btn-sm">Open file</button>
<button id="emptyWriteBtn" class="btn btn-sm">Start writing</button>
<button id="emptyExampleBtn" class="btn btn-sm">Load example</button>
</div>
<form id="urlForm" class="url-form">
<input id="urlInput" type="url" inputmode="url" placeholder="https://raw.githubusercontent.com/…/README.md" aria-label="Markdown URL to load">
<button type="submit" class="btn btn-sm">Load URL</button>
</form>
</div>
</div>
</div>
<div id="editorMount" aria-label="Markdown editor"></div>
<iframe id="htmlPreview" title="Exported HTML preview" sandbox="allow-scripts allow-popups allow-modals allow-downloads"></iframe>
<div id="findBar" class="find-bar" hidden role="search">
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="color:var(--text-muted)"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
<input id="findInput" type="text" placeholder="Find in document" aria-label="Find in document" autocomplete="off" spellcheck="false">
<span id="findCount" class="find-count">0/0</span>
<button id="findPrev" class="icon-btn" aria-label="Previous match" title="Previous (Shift+Enter)">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m11 10-3-3-3 3"/></svg>
</button>
<button id="findNext" class="icon-btn" aria-label="Next match" title="Next (Enter)">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m5 6 3 3 3-3"/></svg>
</button>
<button id="findClose" class="icon-btn" aria-label="Close find" title="Close (Esc)">
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3l10 10M13 3L3 13"/></svg>
</button>
</div>
</div>
<aside class="su-more-tools" aria-label="More free tools">
<p>Other free, no-signup Secutils.dev tools for JWT, SAML, certificates, HTTP echo, and more - <a href="https://{{TOOLS_HOST}}/">Browse all tools →</a></p>
</aside>
</main>
<footer class="su-footer">
<p>A Markdown previewer with Mermaid, GeoJSON/TopoJSON maps, STL and colored 3MF models, math, alerts, and HTML/PDF export.</p>
<p class="su-footer-fineprint">
<button type="button" class="su-footer-link" id="privacyOpen">Privacy</button>
<span aria-hidden="true"> · </span>
<button type="button" class="su-footer-link" id="creditsOpen">Credits</button>
</p>
</footer>
<dialog id="privacyDialog" class="su-dialog" closedby="any" aria-labelledby="privacyDialogTitle">
<header class="su-dialog-header">
<h2 id="privacyDialogTitle">Privacy</h2>
<button type="button" class="su-dialog-close" id="privacyClose" aria-label="Close">
<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3l10 10M13 3L3 13"/></svg>
</button>
</header>
<div class="su-dialog-body">
<p><strong>Your data stays in your browser.</strong> These tools run entirely client-side. Tokens, PEMs, SAML payloads, Markdown source, and mock-response bodies are never sent to the Secutils.dev server in readable form. State that needs to survive a reload (or be shared) lives in the URL fragment (<code>#…</code>), which browsers never transmit to the server.</p>
<p><strong>Short links.</strong> When you copy a short link, your browser encrypts the document and Secutils.dev stores only the encrypted copy, for the period you choose (1, 7, or 14 days). The decryption key exists only in the link, so the server can't read the document. Only the browser that created a link can delete it early. Your IP address is kept for one hour to rate-limit link creation.</p>
<p><strong>Loading from a URL.</strong> When you use <code>?url=</code> or the "Load URL" box, your browser fetches that address directly; the Markdown is read into the page client-side and is never relayed through the Secutils.dev server.</p>
<p><strong>Map basemaps.</strong> GeoJSON and TopoJSON viewers fetch map tiles directly from OpenStreetMap. Tile requests reveal the displayed geographic area. Your Markdown source is not included.</p>
<p><strong>Anonymous usage analytics.</strong> We use <a href="https://plausible.io/" target="_blank" rel="noopener noreferrer">Plausible Analytics</a>, a privacy-first, GDPR-compliant tool, to collect aggregate usage data. No cookies, no personal data, no individual tracking. The data is limited to top pages, referral sources, visit duration, and device-class metadata (device type, OS, country, browser). Full details in the <a href="https://plausible.io/data-policy" target="_blank" rel="noopener noreferrer">Plausible Data Policy</a>.</p>
<p class="su-dialog-fineprint">See the full <a href="https://secutils.dev/privacy" target="_blank" rel="noopener noreferrer">Secutils.dev privacy policy</a> for details on the wider service.</p>
</div>
</dialog>
<dialog id="creditsDialog" class="su-dialog" closedby="any" aria-labelledby="creditsDialogTitle">
<header class="su-dialog-header">
<h2 id="creditsDialogTitle">Credits</h2>
<button type="button" class="su-dialog-close" id="creditsClose" aria-label="Close">
<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3l10 10M13 3L3 13"/></svg>
</button>
</header>
<div class="su-dialog-body">
<p>This tool is powered by the following open-source libraries:</p>
<ul class="su-credits-list">
<li><a href="https://github.com/markedjs/marked" target="_blank" rel="noopener noreferrer"><strong>marked</strong></a> - Markdown parser and compiler, used to render the source into HTML.</li>
<li><a href="https://github.com/highlightjs/highlight.js" target="_blank" rel="noopener noreferrer"><strong>highlight.js</strong></a> - syntax highlighter, used to colourise fenced code blocks.</li>
<li><a href="https://github.com/KaTeX/KaTeX" target="_blank" rel="noopener noreferrer"><strong>KaTeX</strong></a> - math typesetting, used to render <code>$…$</code> and <code>$$…$$</code> formulas.</li>
<li><a href="https://github.com/mermaid-js/mermaid" target="_blank" rel="noopener noreferrer"><strong>Mermaid</strong></a> - diagram renderer, used to turn <code>```mermaid</code> code blocks into inline SVG diagrams.</li>
<li><a href="https://github.com/topojson/topojson-client" target="_blank" rel="noopener noreferrer"><strong>topojson-client</strong></a> - converts TopoJSON objects into GeoJSON for map display.</li>
<li><a href="https://github.com/codemirror/dev" target="_blank" rel="noopener noreferrer"><strong>CodeMirror</strong></a> - extensible code editor, powers the source editing mode.</li>
<li><a href="https://github.com/pagedjs/pagedjs" target="_blank" rel="noopener noreferrer"><strong>Paged.js</strong></a> - CSS Paged Media polyfill, used to paginate the rendered HTML into a vector PDF on Export.</li>
<li><a href="https://github.com/101arrowz/fflate" target="_blank" rel="noopener noreferrer"><strong>fflate</strong></a> - extracts local 3MF ZIP packages in a worker (MIT).</li>
<li><a href="https://github.com/lddubeau/saxes" target="_blank" rel="noopener noreferrer"><strong>saxes</strong></a> - parses namespace-aware 3MF XML in a worker (ISC).</li>
</ul>
<p class="su-dialog-fineprint">All trademarks are property of their respective owners.</p>
</div>
</dialog>
<div id="blockMenu" class="export-menu block-menu" role="menu" aria-label="Block actions" hidden>
<button class="export-item" role="menuitem" data-action="edit">Edit</button>
<button class="export-item" role="menuitem" data-action="done">Mark done</button>
<button class="export-item" role="menuitem" data-action="copy">Copy text</button>
<button class="export-item" role="menuitem" data-action="up">Move up</button>
<button class="export-item" role="menuitem" data-action="down">Move down</button>
<button class="export-item block-menu-danger" role="menuitem" data-action="delete">Delete</button>
</div>
<div id="formatBar" class="export-menu format-bar" role="toolbar" aria-label="Format selection" hidden>
<button type="button" data-format="bold" title="Bold (Ctrl/Cmd+B)" aria-label="Bold"><b>B</b></button>
<button type="button" data-format="italic" title="Italic (Ctrl/Cmd+I)" aria-label="Italic"><i>I</i></button>
<button type="button" data-format="strike" title="Strikethrough" aria-label="Strikethrough"><s>S</s></button>
<button type="button" data-format="highlight" title="Highlight" aria-label="Highlight"><mark>H</mark></button>
<button type="button" data-format="code" title="Inline code" aria-label="Inline code"><code></></code></button>
<span class="format-sep" data-format-sep aria-hidden="true"></span>
<button type="button" data-comment title="Comment (Ctrl/Cmd+Alt+M)" aria-label="Comment"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/><path d="M12 7v6M9 10h6"/></svg></button>
</div>
<input type="file" id="fileInput" accept=".md,.markdown,.txt,.mdx,.html,.htm,.stl,.3mf">
<div id="modelImportStatus" class="toast" role="status" aria-live="polite" hidden>
<span>Importing 3MF model…</span><button id="cancelModelImport" class="btn btn-sm" type="button">Cancel import</button>
</div>
<script id="su-bundle-three-mf" type="text/plain" data-su-bundle="three-mf" data-su-bundle-encoding="gzip-base64"></script>
<div id="toast" class="toast" style="display:none">
<span id="toastMsg"></span>
<button id="toastAction" class="btn btn-sm" type="button" hidden></button>
</div>
<!-- marked / highlight.js are used at top-level inline-script execution (marked.use(...))
so they cannot be `defer`red without restructuring. Network priority is still demoted. -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js" fetchpriority="low"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha384-F/bZzf7p3Joyp5psL90p/p89AZJsndkSoGwRpXcZhleCWhd8SnRuoYo4d0yirjJp" crossorigin="anonymous" fetchpriority="low"></script>
<!-- CodeMirror 6 ESM loader. Falls back to a plain textarea if any import fails. -->
<script type="module">
const mount = document.getElementById('editorMount');
try {
// Unbundled, so both packages share one @codemirror/state instance;
// separate ?bundle builds each inline their own and fail instanceof checks.
const [cm, cmMd] = await Promise.all([
import('https://esm.sh/codemirror@6.0.1'),
import('https://esm.sh/@codemirror/lang-markdown@6.3.0'),
]);
const view = new cm.EditorView({
doc: window.__suInitialDoc || '',
extensions: [
cm.basicSetup,
cmMd.markdown(),
cm.EditorView.lineWrapping,
cm.EditorView.updateListener.of((u) => {
if (u.docChanged) window.__suOnEditorChange?.(u.state.doc.toString());
}),
],
parent: mount,
});
window.__suCreateBlockEditor = (parent, doc) => {
const editor = new cm.EditorView({ doc, extensions: [cm.minimalSetup, cmMd.markdown(), cm.EditorView.lineWrapping], parent });
return {
getText: () => editor.state.doc.toString(),
focus: () => { editor.focus(); editor.dispatch({ selection: { anchor: editor.state.doc.length } }); },
destroy: () => editor.destroy(),
};
};
window.__suEditorAPI = {
kind: 'codemirror',
setText: (t) => {
if (t.length > 1000000) {
view.destroy();
const ta = document.createElement('textarea');
ta.className = 'editor-fallback'; ta.spellcheck = false; ta.value = t;
ta.addEventListener('input', () => window.__suOnEditorChange?.(ta.value));
mount.replaceChildren(ta);
window.__suEditorAPI = { kind: 'textarea', setText: (text) => { ta.value = text; window.__suOnEditorChange?.(text); }, getText: () => ta.value, focus: () => ta.focus() };
window.__suOnEditorChange?.(t);
} else view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: t } });
},
getText: () => view.state.doc.toString(),
focus: () => view.focus(),
};
window.__suEditorReady?.();
} catch (err) {
console.warn('CodeMirror failed to load, falling back to <textarea>:', err);
const ta = document.createElement('textarea');
ta.className = 'editor-fallback';
ta.spellcheck = false;
ta.placeholder = 'Type or paste Markdown here...';
ta.value = window.__suInitialDoc || '';
ta.addEventListener('input', () => window.__suOnEditorChange?.(ta.value));
mount.replaceChildren(ta);
window.__suEditorAPI = {
kind: 'textarea',
setText: (t) => { ta.value = t; window.__suOnEditorChange?.(t); },
getText: () => ta.value,
focus: () => ta.focus(),
};
window.__suEditorReady?.();
}
</script>
<script>
const PAGEDJS_URL = 'https://cdn.jsdelivr.net/npm/pagedjs@0.4.3/dist/paged.polyfill.js';
const MERMAID_URL = 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
const TOPOJSON_URL = 'https://esm.sh/topojson-client@3.1.0?bundle';
const KATEX_VERSION = '0.16.11';
const KATEX_CSS_URL = `https://cdn.jsdelivr.net/npm/katex@${KATEX_VERSION}/dist/katex.min.css`;
const KATEX_JS_URL = `https://cdn.jsdelivr.net/npm/katex@${KATEX_VERSION}/dist/katex.mjs`;
const MD_FILE_EXT = /\.(md|markdown|txt|mdx)$/i;
const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n/;
const FRONTMATTER_TITLE_RE = /^title:\s*['"]?(.+?)['"]?\s*$/m;
const $ = (id) => document.getElementById(id);
const els = {
previewPane: $('previewPane'),
previewWrap: $('previewWrap'),
previewScroll: $('previewScroll'),
previewArticle: $('previewArticle'),
emptyState: $('emptyState'),
loadingState: $('loadingState'),
editorMount: $('editorMount'),
docTitle: $('docTitle'),
docStats: $('docStats'),
fileInput: $('fileInput'),
themeToggle: $('themeToggle'),
skillLink: $('skillLink'),