feat: show language on code blocks

This commit is contained in:
robin committed 2026-08-04 16:12:14 +02:00
1 parent aee4b8c567
commit 975aba1020
2 files changed
+49

No files matched your search

+48
View File
@@ -93,3 +93,51 @@ figure[data-rehype-pretty-code-figure] pre {
figure[data-rehype-pretty-code-figure] code { figure[data-rehype-pretty-code-figure] code {
font-family: var(--font-mono, monospace); font-family: var(--font-mono, monospace);
} }
/* Container für den Code-Block */
figure[data-rehype-pretty-code-figure] {
position: relative;
margin-top: 1.5rem;
margin-bottom: 1.5rem;
border-radius: 0.75rem;
overflow: hidden;
border: 1px solid #27272a; /* Tailwind zinc-800 */
background-color: #0d1117;
}
/* Eventuelle leere Pseudo-Elemente der Figure deaktivieren */
figure[data-rehype-pretty-code-figure]::before {
display: none !important;
}
/* Das Sprach-Badge ganz nach links rücken */
figure[data-rehype-pretty-code-figure] pre[data-language]::before {
content: attr(data-language);
display: block !important;
position: absolute;
top: 0.6rem;
left: 0.6rem; /* <-- Auf 0.5rem (oder 0.4rem) verringert für noch weiter links */
font-family: var(--font-mono, ui-monospace, monospace);
font-size: 0.68rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: #a1a1aa;
background-color: #18181b;
border: 1px solid #27272a;
padding: 0.15rem 0.5rem;
border-radius: 0.375rem;
pointer-events: none;
z-index: 20;
}
/* Platz oben für das Badge schaffen */
figure[data-rehype-pretty-code-figure] pre {
margin: 0 !important;
padding: 1rem !important;
padding-top: 2.4rem !important; /* Genügend Abstand nach oben */
background-color: transparent !important;
overflow-x: auto;
font-size: 0.875rem;
line-height: 1.7;
}
+1
View File
@@ -39,3 +39,4 @@ Willkommen im offiziellen Wiki! Hier findest du alle Informationen zum Projekt.
function sayHello(name: string): string { function sayHello(name: string): string {
return `Hallo, ${name}!`; return `Hallo, ${name}!`;
} }
```