Skip to content

Commit 57b3163

Browse files
committed
fix:clean url and hamburger menu button
1 parent b6ea5a7 commit 57b3163

File tree

7 files changed

+67
-120
lines changed

7 files changed

+67
-120
lines changed

docs/_document.html

Lines changed: 64 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
<script>
1010
(function () {
1111
try {
12-
var theme = localStorage.getItem('theme');
13-
var prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
14-
if (theme === 'dark' || (!theme && prefersDark)) {
15-
document.documentElement.classList.add('dark');
12+
var theme = localStorage.getItem("theme");
13+
var prefersDark =
14+
window.matchMedia &&
15+
window.matchMedia("(prefers-color-scheme: dark)").matches;
16+
if (theme === "dark" || (!theme && prefersDark)) {
17+
document.documentElement.classList.add("dark");
1618
}
1719
} catch (e) {}
1820
})();
@@ -28,9 +30,9 @@
2830
rel="stylesheet"
2931
/>
3032

31-
<link rel="stylesheet" href="css/style.css" type="text/css" />
32-
<link rel="stylesheet" href="css/shared.css" type="text/css" />
33-
<link rel="stylesheet" href="css/hljs-github.css" type="text/css" />
33+
<link rel="stylesheet" href="/css/style.css" type="text/css" />
34+
<link rel="stylesheet" href="/css/shared.css" type="text/css" />
35+
<link rel="stylesheet" href="/css/hljs-github.css" type="text/css" />
3436

3537
<script>
3638
// Tailwind configuration embedded directly
@@ -107,11 +109,7 @@
107109
class="github-corner"
108110
aria-label="View source on Github"
109111
>
110-
<svg
111-
width="80"
112-
height="80"
113-
viewBox="0 0 250 250"
114-
>
112+
<svg width="80" height="80" viewBox="0 0 250 250">
115113
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
116114
<path
117115
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
@@ -133,10 +131,10 @@
133131
class="sidebar w-64 fixed top-0 scroll-hidden left-0 h-full border-r border-border-light dark:border-border-dark bg-background-light dark:bg-background-dark z-40"
134132
>
135133
<div class="flex justify-center items-center mb-12 mt-8 px-8">
136-
<a href="index.html" class="flex items-center">
134+
<a href="/" class="flex items-center">
137135
<img
138136
alt="logo"
139-
src="img/logo-black.svg"
137+
src="/img/logo-black.svg"
140138
class="bg-gray-100 rounded"
141139
height="50px"
142140
width="50px"
@@ -148,50 +146,54 @@
148146
<h3
149147
class="font-semibold text-sm mb-3 text-subtle-light dark:text-subtle-dark uppercase tracking-wider"
150148
>
151-
Getting Started
149+
<a
150+
class="block hover:text-primary dark:hover:text-primary"
151+
href="/"
152+
>Getting Started</a
153+
>
152154
</h3>
153155
<ul
154156
class="space-y-2 text-sm text-subtle-light dark:text-subtle-dark"
155157
>
156158
<li>
157159
<a
158160
class="block hover:text-primary dark:hover:text-primary"
159-
href="index.html#demo"
161+
href="/#demo"
160162
>Demo</a
161163
>
162164
</li>
163165
<li>
164166
<a
165167
class="block hover:text-primary dark:hover:text-primary"
166-
href="index.html#installation"
168+
href="/#installation"
167169
>Installation</a
168170
>
169171
</li>
170172
<li>
171173
<a
172174
class="block hover:text-primary dark:hover:text-primary"
173-
href="index.html#usage"
175+
href="/#usage"
174176
>Usage</a
175177
>
176178
</li>
177179
<li>
178180
<a
179181
class="block hover:text-primary dark:hover:text-primary"
180-
href="index.html#specifications"
182+
href="/#specifications"
181183
>Specs</a
182184
>
183185
</li>
184186
<li>
185187
<a
186188
class="block hover:text-primary dark:hover:text-primary"
187-
href="index.html#tools"
189+
href="/#tools"
188190
>Tools</a
189191
>
190192
</li>
191193
<li>
192194
<a
193195
class="block hover:text-primary dark:hover:text-primary"
194-
href="index.html#security"
196+
href="/#security"
195197
>Security</a
196198
>
197199
</li>
@@ -201,57 +203,61 @@
201203
<h3
202204
class="font-semibold text-sm mb-3 text-subtle-light dark:text-subtle-dark uppercase tracking-wider"
203205
>
204-
Advanced Usage
206+
<a
207+
class="block hover:text-primary dark:hover:text-primary"
208+
href="/using_advanced"
209+
>Advanced Usage</a
210+
>
205211
</h3>
206212
<ul
207213
class="space-y-2 text-sm text-subtle-light dark:text-subtle-dark"
208214
>
209215
<li>
210216
<a
211217
class="block hover:text-primary dark:hover:text-primary"
212-
href="using_advanced.html#instance"
218+
href="/using_advanced#instance"
213219
>Instance</a
214220
>
215221
</li>
216222
<li>
217223
<a
218224
class="block hover:text-primary dark:hover:text-primary"
219-
href="using_advanced.html#options"
225+
href="/using_advanced#options"
220226
>Options</a
221227
>
222228
</li>
223229
<li>
224230
<a
225231
class="block hover:text-primary dark:hover:text-primary"
226-
href="using_advanced.html#extensions"
232+
href="/using_advanced#extensions"
227233
>Known Extensions</a
228234
>
229235
</li>
230236
<li>
231237
<a
232238
class="block hover:text-primary dark:hover:text-primary"
233-
href="using_advanced.html#inline"
239+
href="/using_advanced#inline"
234240
>Inline Markdown</a
235241
>
236242
</li>
237243
<li>
238244
<a
239245
class="block hover:text-primary dark:hover:text-primary"
240-
href="using_advanced.html#highlight"
246+
href="/using_advanced#highlight"
241247
>Highlighting</a
242248
>
243249
</li>
244250
<li>
245251
<a
246252
class="block hover:text-primary dark:hover:text-primary"
247-
href="using_advanced.html#workers"
253+
href="/using_advanced#workers"
248254
>Workers</a
249255
>
250256
</li>
251257
<li>
252258
<a
253259
class="block hover:text-primary dark:hover:text-primary"
254-
href="using_advanced.html#cli-extensions"
260+
href="/using_advanced#cli-extensions"
255261
>CLI Extensions</a
256262
>
257263
</li>
@@ -261,71 +267,75 @@
261267
<h3
262268
class="font-semibold text-sm mb-3 text-subtle-light dark:text-subtle-dark uppercase tracking-wider"
263269
>
264-
Extensibility
270+
<a
271+
class="block hover:text-primary dark:hover:text-primary"
272+
href="/using_pro"
273+
>Extensibility</a
274+
>
265275
</h3>
266276
<ul
267277
class="space-y-2 text-sm text-subtle-light dark:text-subtle-dark"
268278
>
269279
<li>
270280
<a
271281
class="block hover:text-primary dark:hover:text-primary"
272-
href="using_pro.html#use"
282+
href="/using_pro#use"
273283
>marked.use()</a
274284
>
275285
</li>
276286
<li>
277287
<a
278288
class="block hover:text-primary dark:hover:text-primary"
279-
href="using_pro.html#renderer"
289+
href="/using_pro#renderer"
280290
>Renderer</a
281291
>
282292
</li>
283293
<li>
284294
<a
285295
class="block hover:text-primary dark:hover:text-primary"
286-
href="using_pro.html#tokenizer"
296+
href="/using_pro#tokenizer"
287297
>Tokenizer</a
288298
>
289299
</li>
290300
<li>
291301
<a
292302
class="block hover:text-primary dark:hover:text-primary"
293-
href="using_pro.html#walk-tokens"
303+
href="/using_pro#walk-tokens"
294304
>Walk Tokens</a
295305
>
296306
</li>
297307
<li>
298308
<a
299309
class="block hover:text-primary dark:hover:text-primary"
300-
href="using_pro.html#hooks"
310+
href="/using_pro#hooks"
301311
>Hooks</a
302312
>
303313
</li>
304314
<li>
305315
<a
306316
class="block hover:text-primary dark:hover:text-primary"
307-
href="using_pro.html#extensions"
317+
href="/using_pro#extensions"
308318
>Custom Extensions</a
309319
>
310320
</li>
311321
<li>
312322
<a
313323
class="block hover:text-primary dark:hover:text-primary"
314-
href="using_pro.html#async"
324+
href="/using_pro#async"
315325
>Async Marked</a
316326
>
317327
</li>
318328
<li>
319329
<a
320330
class="block hover:text-primary dark:hover:text-primary"
321-
href="using_pro.html#lexer"
331+
href="/using_pro#lexer"
322332
>Lexer</a
323333
>
324334
</li>
325335
<li>
326336
<a
327337
class="block hover:text-primary dark:hover:text-primary"
328-
href="using_pro.html#parser"
338+
href="/using_pro#parser"
329339
>Parser</a
330340
>
331341
</li>
@@ -335,29 +345,33 @@
335345
<h3
336346
class="font-semibold text-sm mb-3 text-subtle-light dark:text-subtle-dark uppercase tracking-wider"
337347
>
338-
Contributing
348+
<a
349+
class="block hover:text-primary dark:hover:text-primary"
350+
href="/contributing"
351+
>Contributing</a
352+
>
339353
</h3>
340354
<ul
341355
class="space-y-2 text-sm text-subtle-light dark:text-subtle-dark"
342356
>
343357
<li>
344358
<a
345359
class="block hover:text-primary dark:hover:text-primary"
346-
href="contributing.html#design-principles"
360+
href="/contributing#design-principles"
347361
>Design Principles</a
348362
>
349363
</li>
350364
<li>
351365
<a
352366
class="block hover:text-primary dark:hover:text-primary"
353-
href="contributing.html#priorities"
367+
href="/contributing#priorities"
354368
>Priorities</a
355369
>
356370
</li>
357371
<li>
358372
<a
359373
class="block hover:text-primary dark:hover:text-primary"
360-
href="contributing.html#test-early-often-and-everything"
374+
href="/contributing#test-early-often-and-everything"
361375
>Testing</a
362376
>
363377
</li>
@@ -369,28 +383,28 @@
369383
<li>
370384
<a
371385
class="block hover:text-primary dark:hover:text-primary"
372-
href="code_of_conduct.html"
386+
href="/code_of_conduct"
373387
>Code of Conduct</a
374388
>
375389
</li>
376390
<li>
377391
<a
378392
class="block hover:text-primary dark:hover:text-primary"
379-
href="authors.html"
393+
href="/authors"
380394
>Authors</a
381395
>
382396
</li>
383397
<li>
384398
<a
385399
class="block hover:text-primary dark:hover:text-primary"
386-
href="publishing.html"
400+
href="/publishing"
387401
>Publishing</a
388402
>
389403
</li>
390404
<li>
391405
<a
392406
class="block hover:text-primary dark:hover:text-primary"
393-
href="license.html"
407+
href="/license"
394408
>License</a
395409
>
396410
</li>
@@ -401,9 +415,7 @@
401415
<main class="main-content flex-1 ml-64 px-12 py-8">
402416
<div class="max-w-5xl mx-auto">
403417
<div class="flex justify-between items-center mb-16">
404-
<h1
405-
class="text-5xl font-bold text-text-light dark:text-text-dark"
406-
>
418+
<h1 class="text-5xl font-bold text-text-light dark:text-text-dark">
407419
Marked Documentation
408420
</h1>
409421
<button
@@ -430,6 +442,6 @@
430442
</main>
431443
</div>
432444

433-
<script src="js/index.js"></script>
445+
<script src="/js/index.js"></script>
434446
</body>
435-
</html>
447+
</html>

docs/build.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,6 @@ async function build(currentDir, tmpl, testResultsTable) {
125125
await mkdir(dirname(outfile), { recursive: true });
126126
console.log('Writing file ' + outfile);
127127
await writeFile(outfile, html, { mode });
128-
// For .html files generated from .md, also create clean URL version (slug/index.html)
129-
// This preserves backwards compatibility with existing links like /using_pro
130-
if (parsed.ext === '.html' && parsed.name !== 'index') {
131-
const cleanUrlDir = join(dirname(outfile), parsed.name);
132-
const cleanUrlFile = join(cleanUrlDir, 'index.html');
133-
await mkdir(cleanUrlDir, { recursive: true });
134-
console.log('Writing clean URL file ' + cleanUrlFile);
135-
await writeFile(cleanUrlFile, html, { mode });
136-
}
137128
}
138129
}
139130
}

docs/css/style.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pre {
113113

114114
/* Mobile Menu Toggle Button */
115115
.mobile-menu-toggle {
116-
display: none; /* Hidden on desktop */
116+
display: none; /* Hidden on desktop by default */
117117
position: fixed;
118118
top: 16px;
119119
left: 16px;
@@ -127,7 +127,6 @@ pre {
127127
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
128128
cursor: pointer;
129129
transition: background-color 0.3s ease, transform 0.2s ease;
130-
display: flex;
131130
align-items: center;
132131
justify-content: center;
133132
}

0 commit comments

Comments
 (0)