-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
335 lines (327 loc) · 15.8 KB
/
index.html
File metadata and controls
335 lines (327 loc) · 15.8 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<base data-trunk-public-url />
<title>MarkNest Fallback Lab</title>
<meta
name="description"
content="Upload a Markdown ZIP, folder, or single file, inspect entry candidates, tune output controls, download debug bundles, and switch between browser and local server PDF export."
/>
<link data-trunk rel="rust" href="crates/marknest-wasm/Cargo.toml" data-bindgen-target="web" />
<link data-trunk rel="css" href="web/app.css" />
<link data-trunk rel="copy-file" href="web/app.js" />
<link data-trunk rel="copy-file" href="web/export_policy.mjs" />
<link data-trunk rel="copy-file" href="web/output_options.mjs" />
<link data-trunk rel="copy-file" href="web/remote_assets.mjs" />
<link data-trunk rel="copy-file" href="web/runtime_sync.mjs" />
<link data-trunk rel="copy-file" href="web/wasm-example.html" />
<link data-trunk rel="copy-file" href="web/wasm-example.js" />
<link data-trunk rel="copy-file" href="web/wasm-example-support.mjs" />
<link data-trunk rel="copy-file" href="web/github_url_input.mjs" />
<link data-trunk rel="copy-file" href="web/github_workspace_loader.mjs" />
<link data-trunk rel="copy-file" href="web/zip_from_files.mjs" />
<link data-trunk rel="copy-dir" href="runtime-assets" />
<script src="./runtime-assets/html2pdf/html2pdf.bundle.min.js"></script>
</head>
<body>
<div class="page-shell">
<header class="hero">
<div class="hero-copy">
<p class="eyebrow">Phase 8 · Output Controls</p>
<h1>Preview in the browser, shape the output, and keep a reproducible debug bundle beside every export.</h1>
<p class="hero-summary">
MarkNest analyzes ZIP archives, folders, and single Markdown files in WASM, keeps diagnostics visible,
lets you adjust themes, CSS, metadata, and print settings, then reuses the same option model for browser
export, debug bundles, and the local Chromium fallback service.
</p>
<p class="hero-summary">
Need a smaller surface for API checks? Open the
<a href="./wasm-example.html">standalone WASM example</a>
to exercise `analyzeZipWithOptions`, `strip_zip_prefix`, and `runtime_assets_base_url` without the full app shell.
</p>
</div>
<div class="hero-meta">
<p>Shared output options</p>
<p>Debug bundle download</p>
<p>Local fallback service</p>
</div>
</header>
<section class="workspace-grid">
<aside class="sidebar">
<section class="panel upload-panel">
<div class="panel-heading">
<p class="panel-kicker">Input</p>
<h2>Upload</h2>
</div>
<label class="dropzone" id="dropzone-label">
<span class="dropzone-title">Choose a `.zip`, `.md` file, or drop a folder</span>
<span class="dropzone-body">Drag and drop a ZIP archive, a Markdown file, or a folder. The browser processes everything locally.</span>
</label>
<input id="zip-input" class="visually-hidden" type="file" accept=".zip,.md,.markdown,application/zip" />
<input id="folder-input" class="visually-hidden" type="file" webkitdirectory />
<div class="upload-actions">
<button id="browse-file" class="action-button action-button-secondary" type="button">Browse File</button>
<button id="browse-folder" class="action-button action-button-secondary" type="button">Browse Folder</button>
</div>
<p id="file-name" class="panel-note">No file or folder loaded yet.</p>
<p id="local-image-warning" class="panel-note is-warning" hidden>
This Markdown file references local images that cannot be resolved in the browser.
Only external (HTTP) images will be displayed. Upload the parent folder instead.
</p>
</section>
<section class="panel status-panel">
<div class="panel-heading">
<p class="panel-kicker">Session</p>
<h2>Status</h2>
</div>
<div id="status-chip" class="status-chip status-waiting">Booting</div>
<p id="status-message" class="status-message">Waiting for the WASM runtime to initialize.</p>
<dl class="summary-grid">
<div>
<dt>Entries</dt>
<dd id="entry-count">0</dd>
</div>
<div>
<dt>Missing Assets</dt>
<dd id="missing-count">0</dd>
</div>
<div>
<dt>Warnings</dt>
<dd id="warning-count">0</dd>
</div>
<div>
<dt>Selected</dt>
<dd id="selected-entry-label">None</dd>
</div>
</dl>
</section>
<section class="panel export-panel">
<div class="panel-heading">
<p class="panel-kicker">Export</p>
<h2>PDF Modes</h2>
</div>
<div class="control-stack">
<label class="control-field" for="quality-mode">
<span class="control-label">Quality Mode</span>
<select id="quality-mode" class="control-input">
<option value="browser">Browser Fast</option>
<option value="high-quality">High Quality Fallback</option>
</select>
</label>
<label class="control-field" for="fallback-url">
<span class="control-label">Fallback Server</span>
<input
id="fallback-url"
class="control-input"
type="url"
value="http://127.0.0.1:3476"
spellcheck="false"
/>
</label>
</div>
<div class="action-stack">
<button id="download-selected" class="action-button" type="button" disabled>
Download Selected PDF
</button>
<button id="download-batch" class="action-button action-button-secondary" type="button" disabled>
Download All PDFs as ZIP
</button>
<button id="download-debug" class="action-button action-button-muted" type="button" disabled>
Download Debug Bundle
</button>
</div>
<p class="panel-note">
Browser mode stays local to the tab. High Quality mode sends the same ZIP plus output controls to a
local fallback service and returns binary PDF or ZIP responses directly.
</p>
<p id="scale-note" class="panel-note">Archive size guidance will appear after upload.</p>
</section>
<section class="panel output-panel">
<div class="panel-heading">
<p class="panel-kicker">Output</p>
<h2>Controls</h2>
</div>
<div class="control-stack control-grid">
<label class="control-field" for="theme-input">
<span class="control-label">Theme</span>
<select id="theme-input" class="control-input">
<option value="github">GitHub</option>
<option value="default">Default</option>
<option value="docs">Docs</option>
<option value="plain">Plain</option>
</select>
</label>
<label class="control-field" for="page-size-input">
<span class="control-label">Page Size</span>
<select id="page-size-input" class="control-input">
<option value="a4">A4</option>
<option value="letter">Letter</option>
</select>
</label>
<label class="control-field" for="margin-top-input">
<span class="control-label">Top Margin (mm)</span>
<input id="margin-top-input" class="control-input" type="number" min="0" step="1" value="16" />
</label>
<label class="control-field" for="margin-right-input">
<span class="control-label">Right Margin (mm)</span>
<input id="margin-right-input" class="control-input" type="number" min="0" step="1" value="16" />
</label>
<label class="control-field" for="margin-bottom-input">
<span class="control-label">Bottom Margin (mm)</span>
<input id="margin-bottom-input" class="control-input" type="number" min="0" step="1" value="16" />
</label>
<label class="control-field" for="margin-left-input">
<span class="control-label">Left Margin (mm)</span>
<input id="margin-left-input" class="control-input" type="number" min="0" step="1" value="16" />
</label>
<label class="control-field toggle-field" for="landscape-input">
<span class="control-label">Orientation</span>
<span class="toggle-row">
<input id="landscape-input" type="checkbox" />
<span>Landscape PDF</span>
</span>
</label>
<label class="control-field toggle-field" for="toc-input">
<span class="control-label">Outline</span>
<span class="toggle-row">
<input id="toc-input" type="checkbox" />
<span>Insert TOC</span>
</span>
</label>
<label class="control-field toggle-field" for="sanitize-html-input">
<span class="control-label">HTML Safety</span>
<span class="toggle-row">
<input id="sanitize-html-input" type="checkbox" checked />
<span>Sanitize raw HTML</span>
</span>
</label>
<label class="control-field" for="mermaid-mode-input">
<span class="control-label">Mermaid</span>
<select id="mermaid-mode-input" class="control-input">
<option value="off">Off</option>
<option value="auto">Auto</option>
<option value="on">On</option>
</select>
</label>
<label class="control-field" for="math-mode-input">
<span class="control-label">Math</span>
<select id="math-mode-input" class="control-input">
<option value="off">Off</option>
<option value="auto">Auto</option>
<option value="on">On</option>
</select>
</label>
</div>
<label class="control-field" for="css-input">
<span class="control-label">Custom CSS</span>
<textarea
id="css-input"
class="control-input control-textarea"
rows="5"
placeholder="body { color: #102a43; }"
></textarea>
</label>
<div class="control-stack control-grid metadata-grid">
<label class="control-field" for="title-input">
<span class="control-label">Metadata Title</span>
<input id="title-input" class="control-input" type="text" placeholder="Guide Pack" />
</label>
<label class="control-field" for="author-input">
<span class="control-label">Author</span>
<input id="author-input" class="control-input" type="text" placeholder="Docs Team" />
</label>
<label class="control-field" for="subject-input">
<span class="control-label">Subject</span>
<input id="subject-input" class="control-input" type="text" placeholder="Architecture" />
</label>
</div>
<label class="control-field" for="header-template-input">
<span class="control-label">Header Template</span>
<textarea
id="header-template-input"
class="control-input control-textarea"
rows="4"
placeholder="<div>{{title}} · {{entryPath}}</div>"
></textarea>
</label>
<iframe
id="header-preview-frame"
class="template-preview-frame"
title="Header template preview"
sandbox=""
></iframe>
<label class="control-field" for="footer-template-input">
<span class="control-label">Footer Template</span>
<textarea
id="footer-template-input"
class="control-input control-textarea"
rows="4"
placeholder="<div>{{pageNumber}} / {{totalPages}} · {{date}}</div>"
></textarea>
</label>
<iframe
id="footer-preview-frame"
class="template-preview-frame"
title="Footer template preview"
sandbox=""
></iframe>
<p class="panel-note">
Template previews use sample token values in a sandboxed frame. Browser Fast export applies theme,
CSS, metadata, page size, per-side margins, orientation, generated TOC, and document HTML sanitization
locally, while header and footer templates require High Quality Fallback to affect the PDF.
</p>
</section>
<section class="panel entries-panel">
<div class="panel-heading">
<p class="panel-kicker">Entries</p>
<h2>Markdown Candidates</h2>
</div>
<div id="entry-list" class="entry-list empty-state">
Load a ZIP archive, folder, or Markdown file to inspect entry candidates.
</div>
</section>
<section class="panel diagnostics-panel">
<div class="panel-heading">
<p class="panel-kicker">Diagnostics</p>
<h2>Warnings and Errors</h2>
</div>
<div class="diagnostic-columns">
<div>
<h3>Warnings</h3>
<ul id="warning-list" class="diagnostic-list">
<li>Warnings will appear after analysis.</li>
</ul>
</div>
<div>
<h3>Errors</h3>
<ul id="error-list" class="diagnostic-list">
<li>Errors will appear after analysis.</li>
</ul>
</div>
</div>
</section>
</aside>
<main class="preview-column">
<section class="panel preview-panel">
<div class="preview-header">
<div>
<p class="panel-kicker">Preview</p>
<h2 id="preview-title">No entry selected</h2>
</div>
<p id="preview-caption" class="preview-caption">Upload a ZIP, folder, or Markdown file to render the selected entry as HTML.</p>
</div>
<iframe
id="preview-frame"
class="preview-frame"
title="Rendered Markdown preview"
srcdoc="<!doctype html><html><body style='font-family: Georgia, serif; background: #fbf7ef; color: #47362b; display: grid; place-items: center; min-height: 100vh; margin: 0;'><div style='padding: 2rem; text-align: center; max-width: 32rem;'><h1 style='margin: 0 0 1rem;'>MarkNest Preview Lab</h1><p style='margin: 0;'>Choose a ZIP archive, drop a folder, or upload a Markdown file to preview the rendered document here.</p></div></body></html>"
></iframe>
</section>
</main>
</section>
</div>
<script type="module" src="./app.js"></script>
</body>
</html>