Skip to content

Commit 95875c1

Browse files
Fix styling and markdown output
1 parent 7309594 commit 95875c1

File tree

8 files changed

+134
-90
lines changed

8 files changed

+134
-90
lines changed

hugo.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@ outputFormats:
7474
isPlainText: true
7575
mediaType: "text/plain"
7676
notAlternative: true
77-
# llms.txt, see layouts/single.llmstxt.txt
78-
llmstxt:
79-
baseName: llms
80-
mediaType: "text/plain"
77+
# Markdown for LLMs, see layouts/_default/single.markdown.md
78+
Markdown:
79+
baseName: index
80+
mediaType: "text/markdown"
8181
isPlainText: true
82-
notAlternative: true
82+
isHTML: false
83+
permalinkable: true
8384

8485
# Enable custom output formats
8586
# (only generate the custom output files once)
@@ -91,7 +92,7 @@ outputs:
9192
- robots
9293
page:
9394
- html
94-
- llmstxt
95+
- Markdown
9596

9697
languages:
9798
en:

hugo_stats.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
"With-systemd-Highly-recommended",
129129
"Without-packages",
130130
"Without-systemd",
131+
"[display:none]",
131132
"absolute",
132133
"aspect-video",
133134
"bake-action",
@@ -219,6 +220,7 @@
219220
"dark:hover:bg-blue-dark",
220221
"dark:hover:bg-blue-dark-500",
221222
"dark:hover:bg-gray-dark-200",
223+
"dark:hover:bg-gray-dark-400",
222224
"dark:hover:bg-gray-dark-500",
223225
"dark:hover:text-blue-dark",
224226
"dark:prose-invert",
@@ -228,7 +230,6 @@
228230
"dark:text-amber-dark",
229231
"dark:text-blue-dark",
230232
"dark:text-divider-dark",
231-
"dark:text-gray-400",
232233
"dark:text-gray-dark",
233234
"dark:text-gray-dark-300",
234235
"dark:text-gray-dark-500",
@@ -285,6 +286,7 @@
285286
"grid-cols-1",
286287
"group",
287288
"group-hover:block'",
289+
"group-open:[display:block]",
288290
"group-open:rotate-180",
289291
"h-16",
290292
"h-2",
@@ -313,7 +315,6 @@
313315
"hover:dark:text-blue-dark",
314316
"hover:drop-shadow-lg",
315317
"hover:opacity-90",
316-
"hover:text-blue-600",
317318
"hover:text-blue-light",
318319
"hover:text-white",
319320
"hover:underline",
@@ -333,7 +334,9 @@
333334
"justify-center",
334335
"justify-end",
335336
"justify-evenly",
337+
"leading-none",
336338
"leading-snug",
339+
"leading-tight",
337340
"left-0",
338341
"lg:block",
339342
"lg:flex",
@@ -388,12 +391,13 @@
388391
"ml-2",
389392
"ml-3",
390393
"ml-4",
394+
"ml-auto",
391395
"mt-1",
392396
"mt-2",
393397
"mt-20",
394-
"mt-3",
395398
"mt-4",
396399
"mt-8",
400+
"mt-[2px]",
397401
"mx-auto",
398402
"my-0",
399403
"my-1",
@@ -406,6 +410,7 @@
406410
"open-kapa-widget",
407411
"openSUSE-and-SLES",
408412
"origin-bottom-right",
413+
"origin-top-right",
409414
"ot-sdk-show-settings",
410415
"outline-none",
411416
"overflow-clip",
@@ -460,7 +465,6 @@
460465
"rounded-[6px]",
461466
"rounded-b-lg",
462467
"rounded-full",
463-
"rounded-lg",
464468
"rounded-sm",
465469
"scale-50",
466470
"scale-75",
@@ -471,6 +475,7 @@
471475
"self-start",
472476
"shadow",
473477
"shadow-lg",
478+
"shadow-md",
474479
"sm:block",
475480
"sm:flex",
476481
"sm:flex-row",
@@ -488,10 +493,8 @@
488493
"text-amber-light",
489494
"text-base",
490495
"text-black",
491-
"text-blue-500",
492496
"text-blue-light",
493497
"text-divider-light",
494-
"text-gray-500",
495498
"text-gray-light",
496499
"text-gray-light-200",
497500
"text-gray-light-300",
@@ -523,11 +526,13 @@
523526
"top-full",
524527
"transform",
525528
"transition",
529+
"transition-colors",
526530
"transition-transform",
527531
"truncate",
528532
"underline-offset-2",
529533
"uppercase",
530534
"w-2",
535+
"w-56",
531536
"w-8",
532537
"w-[1200px]",
533538
"w-[32px]",

layouts/_default/single.llmstxt.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{- $slug := .File.TranslationBaseName -}}
2+
{{- $outputPath := printf "%s.md" $slug -}}
3+
{{- .Page.Store.Set "RelativePermalink" (print "/" $outputPath) -}}
4+
5+
{{ .RawContent }}
6+
7+
{{ .RenderShortcodes }}

layouts/partials/aside.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@
1212
</div>
1313
{{- end }}
1414
{{- end }}
15-
<span>{{ partial "llms-dropdown.html" }}</span>
1615
</aside>

layouts/partials/content-default.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<div class="flex gap-8 w-full">
22
<article class="prose min-w-0 flex-[2_2_0%] max-w-4xl dark:prose-invert">
33
{{ partial "breadcrumbs.html" . }}
4-
<h1 data-pagefind-weight="10" class="scroll-mt-36">{{ .Title }}</h1>
4+
<h1 data-pagefind-weight="10" class="scroll-mt-36 flex items-center">
5+
<span>{{ .Title }}</span>
6+
<span class="ml-auto">
7+
{{ partial "md-dropdown.html" . }}
8+
</span>
9+
</h1>
510

611
<div class="block lg:hidden">
712
{{ partialCached "pagemeta.html" . . }}

layouts/partials/llms-dropdown.html

Lines changed: 0 additions & 73 deletions
This file was deleted.

layouts/partials/md-dropdown.html

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<details class="group relative z-50 inline-block">
2+
<summary
3+
class="inline-flex cursor-pointer items-center gap-2 rounded border border-gray-light-200 bg-gray-light-200 px-4 py-2 text-base font-semibold text-black transition-colors hover:bg-gray-light-300 dark:border-gray-dark-200 dark:bg-gray-dark-300 dark:text-white dark:hover:bg-gray-dark-400"
4+
>
5+
<span>Copy page</span>
6+
<svg
7+
class="h-2 w-2 transform transition-transform group-open:rotate-180"
8+
xmlns="http://www.w3.org/2000/svg"
9+
fill="none"
10+
viewBox="0 0 24 24"
11+
stroke="currentColor"
12+
>
13+
<path
14+
stroke-linecap="round"
15+
stroke-linejoin="round"
16+
stroke-width="2"
17+
d="M19 9l-7 7-7-7"
18+
/>
19+
</svg>
20+
</summary>
21+
22+
<!-- Dropdown menu -->
23+
<div
24+
class="absolute right-0 z-50 mt-2 w-56 origin-top-right rounded border border-gray-light-200 bg-gray-light-200 p-2 text-sm text-black shadow-md [display:none] group-open:[display:block] dark:border-gray-dark-200 dark:bg-gray-dark-300 dark:text-white"
25+
>
26+
<button
27+
onclick="copyMarkdown()"
28+
class="flex w-full items-start gap-2 rounded px-2 py-2 text-left transition-colors hover:bg-gray-light-300 dark:hover:bg-gray-dark-400"
29+
>
30+
<span class="icon-svg mt-[2px] text-base leading-none">
31+
{{ partial "icon" "content_copy" }}
32+
</span>
33+
<div class="leading-tight">
34+
<div class="text-base font-bold">Copy page</div>
35+
<div class="text-sm text-gray-light-500 dark:text-gray-dark-500">
36+
Copy this page as Markdown for LLMs
37+
</div>
38+
</div>
39+
</button>
40+
41+
<button
42+
onclick="viewPlainText()"
43+
class="flex w-full items-start gap-2 rounded px-2 py-2 text-left transition-colors hover:bg-gray-light-300 dark:hover:bg-gray-dark-400"
44+
>
45+
<span class="icon-svg mt-[2px] text-base leading-none">
46+
{{ partial "icon" "description" }}
47+
</span>
48+
<div class="leading-tight">
49+
<div class="text-base font-bold">View as Markdown</div>
50+
<div class="text-sm text-gray-light-500 dark:text-gray-dark-500">
51+
View this page as plain text
52+
</div>
53+
</div>
54+
</button>
55+
56+
<button
57+
onclick="openInDocsAI()"
58+
class="flex w-full items-start gap-2 rounded px-2 py-2 text-left transition-colors hover:bg-gray-light-300 dark:hover:bg-gray-dark-400"
59+
>
60+
<span class="icon-svg mt-[2px] text-base leading-none">
61+
{{ partial "icon" "search" }}
62+
</span>
63+
<div class="leading-tight">
64+
<div class="text-base font-bold">Search Docs AI</div>
65+
<div class="text-sm text-gray-light-500 dark:text-gray-dark-500">
66+
Ask questions with Docs AI
67+
</div>
68+
</div>
69+
</button>
70+
</div>
71+
</details>
72+
73+
<script>
74+
function getCurrentPlaintextUrl() {
75+
const url = window.location.href.split("#")[0].replace(/\/$/, "");
76+
return `${url}.md`;
77+
}
78+
79+
function copyMarkdown() {
80+
fetch(getCurrentPlaintextUrl())
81+
.then((response) => response.text())
82+
.then((text) => {
83+
navigator.clipboard
84+
.writeText(text)
85+
.then(() => alert("Markdown copied to clipboard!"))
86+
.catch((err) => alert("Failed to copy markdown: " + err));
87+
})
88+
.catch((err) => alert("Error fetching markdown: " + err));
89+
}
90+
91+
function viewPlainText() {
92+
window.open(getCurrentPlaintextUrl(), "_blank");
93+
}
94+
95+
function openInDocsAI() {
96+
const kapaButton = document.querySelector(".open-kapa-widget");
97+
if (kapaButton) {
98+
kapaButton.click();
99+
} else {
100+
alert("Couldn't find Docs AI.");
101+
}
102+
}
103+
</script>

0 commit comments

Comments
 (0)