|
1 | 1 | @plugin '@tailwindcss/typography'; |
2 | 2 |
|
3 | 3 | @layer base { |
| 4 | + /* ===== Override default Tailwind Typography styles ===== */ |
4 | 5 | .prose { |
5 | 6 | @apply prose-headings:!mb-3 prose-headings:!text-foreground prose-h3:italic prose-p:!text-foreground prose-a:!text-foreground prose-a:!decoration-dashed prose-a:underline-offset-8 hover:prose-a:text-accent prose-blockquote:!border-l-accent/50 prose-blockquote:opacity-80 prose-figcaption:!text-foreground prose-figcaption:opacity-70 prose-strong:!text-foreground prose-code:rounded prose-code:bg-muted/75 prose-code:p-1 prose-code:!text-foreground prose-code:before:!content-none prose-code:after:!content-none prose-ol:!text-foreground prose-ul:overflow-x-clip prose-ul:!text-foreground prose-li:marker:!text-accent prose-table:text-foreground prose-th:border prose-th:border-border prose-td:border prose-td:border-border prose-img:mx-auto prose-img:!my-2 prose-img:border-2 prose-img:border-border prose-hr:!border-border; |
| 7 | + |
| 8 | + a { |
| 9 | + @apply break-words hover:!text-accent; |
| 10 | + } |
| 11 | + |
| 12 | + details { |
| 13 | + @apply inline-block cursor-pointer text-foreground select-none [&_p]:hidden [&_ul]:!my-0; |
| 14 | + } |
| 15 | + |
| 16 | + summary { |
| 17 | + @apply focus-visible:no-underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent focus-visible:outline-dashed; |
| 18 | + } |
| 19 | + |
| 20 | + thead th:first-child, |
| 21 | + tbody td:first-child, |
| 22 | + tfoot td:first-child { |
| 23 | + padding-inline-start: 0.5714286em !important; |
| 24 | + } |
6 | 25 | } |
7 | | - .prose a { |
8 | | - @apply break-words hover:!text-accent; |
9 | | - } |
10 | | - .prose thead th:first-child, |
11 | | - tbody td:first-child, |
12 | | - tfoot td:first-child { |
13 | | - padding-inline-start: 0.5714286em !important; |
14 | | - } |
15 | | - .prose h2#table-of-contents { |
16 | | - @apply mb-2; |
17 | | - } |
18 | | - .prose details { |
19 | | - @apply inline-block cursor-pointer text-foreground select-none; |
20 | | - } |
21 | | - .prose summary { |
22 | | - @apply focus-visible:no-underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent focus-visible:outline-dashed; |
| 26 | + |
| 27 | + /* ===== Code Blocks & Syntax Highlighting ===== */ |
| 28 | + .astro-code { |
| 29 | + @apply border bg-(--shiki-light-bg) text-(--shiki-light) outline-border [&_span]:text-(--shiki-light); |
23 | 30 | } |
24 | | - .prose h2#table-of-contents + p { |
25 | | - @apply hidden; |
| 31 | + |
| 32 | + html[data-theme="dark"] .astro-code { |
| 33 | + @apply bg-(--shiki-dark-bg) text-(--shiki-dark) [&_span]:text-(--shiki-dark); |
26 | 34 | } |
27 | 35 |
|
28 | | - /* ===== Code Blocks & Syntax Highlighting ===== */ |
29 | | - pre:has(code) { |
30 | | - @apply border border-border; |
| 36 | + /* Styles for Shiki transformers */ |
| 37 | + /* https://shiki.style/packages/transformers */ |
| 38 | + .astro-code { |
| 39 | + .line.diff.add { |
| 40 | + @apply relative *:bg-green-500/20 before:absolute before:-left-3 before:text-green-500 before:content-['+']; |
| 41 | + } |
| 42 | + .line.diff.remove { |
| 43 | + @apply relative *:bg-red-500/30 before:absolute before:-left-3 before:text-red-500 before:content-['-']; |
| 44 | + } |
| 45 | + .line.highlighted { |
| 46 | + @apply *:!bg-slate-400/20; |
| 47 | + } |
| 48 | + .highlighted-word { |
| 49 | + @apply rounded-sm border border-border px-0.5 py-px; |
| 50 | + } |
31 | 51 | } |
32 | 52 |
|
| 53 | + /* Break words in code and blockqoute */ |
33 | 54 | .prose code, |
34 | 55 | .prose blockquote { |
35 | 56 | @apply break-words; |
|
39 | 60 | /* add line breaks whenever necessary for codes under table */ |
40 | 61 | @apply break-all sm:break-normal; |
41 | 62 | } |
42 | | - |
43 | | - pre > code { |
44 | | - white-space: pre; |
45 | | - } |
46 | | - |
47 | | - /* Apply Dark Theme (if multi-theme specified) */ |
48 | | - html[data-theme="dark"] pre:has(code), |
49 | | - html[data-theme="dark"] pre:has(code) span { |
50 | | - color: var(--shiki-dark) !important; |
51 | | - background-color: var(--shiki-dark-bg) !important; |
52 | | - font-style: var(--shiki-dark-font-style) !important; |
53 | | - font-weight: var(--shiki-dark-font-weight) !important; |
54 | | - text-decoration: var(--shiki-dark-text-decoration) !important; |
55 | | - } |
56 | 63 | } |
0 commit comments