Spaces:
Runtime error
Runtime error
light theme: Update code block styles and highlight.js themes
Browse files- src/lib/components/CodeBlock.svelte +3 -4
- src/styles/highlight-js.css +195 -1
- src/styles/main.css +4 -0
src/lib/components/CodeBlock.svelte
CHANGED
|
@@ -38,7 +38,7 @@
|
|
| 38 |
>
|
| 39 |
{#if showPreview}
|
| 40 |
<button
|
| 41 |
-
class="btn h-7 gap-1 rounded-lg border
|
| 42 |
disabled={loading}
|
| 43 |
onclick={() => {
|
| 44 |
if (!loading) {
|
|
@@ -58,13 +58,12 @@
|
|
| 58 |
{/if}
|
| 59 |
<CopyToClipBoardBtn
|
| 60 |
iconClassNames="size-3"
|
| 61 |
-
classNames="btn rounded-lg border size-7 text-sm shadow-sm
|
| 62 |
value={rawCode}
|
| 63 |
/>
|
| 64 |
</div>
|
| 65 |
</div>
|
| 66 |
-
<pre
|
| 67 |
-
class="scrollbar-custom overflow-auto px-5 font-mono transition-[height] scrollbar-thumb-gray-500 hover:scrollbar-thumb-gray-400 dark:scrollbar-thumb-white/10 dark:hover:scrollbar-thumb-white/20"><code
|
| 68 |
><!-- eslint-disable svelte/no-at-html-tags -->{@html DOMPurify.sanitize(code)}</code
|
| 69 |
></pre>
|
| 70 |
|
|
|
|
| 38 |
>
|
| 39 |
{#if showPreview}
|
| 40 |
<button
|
| 41 |
+
class="btn h-7 gap-1 rounded-lg border px-2 text-xs shadow-sm backdrop-blur transition-none hover:border-gray-500 active:shadow-inner disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-600 dark:bg-gray-600/50 dark:hover:border-gray-500"
|
| 42 |
disabled={loading}
|
| 43 |
onclick={() => {
|
| 44 |
if (!loading) {
|
|
|
|
| 58 |
{/if}
|
| 59 |
<CopyToClipBoardBtn
|
| 60 |
iconClassNames="size-3"
|
| 61 |
+
classNames="btn transition-none rounded-lg border size-7 text-sm shadow-sm dark:bg-gray-600/50 backdrop-blur dark:hover:border-gray-500 active:shadow-inner dark:border-gray-600 hover:border-gray-500"
|
| 62 |
value={rawCode}
|
| 63 |
/>
|
| 64 |
</div>
|
| 65 |
</div>
|
| 66 |
+
<pre class="scrollbar-custom overflow-auto px-5 font-mono transition-[height]"><code
|
|
|
|
| 67 |
><!-- eslint-disable svelte/no-at-html-tags -->{@html DOMPurify.sanitize(code)}</code
|
| 68 |
></pre>
|
| 69 |
|
src/styles/highlight-js.css
CHANGED
|
@@ -1 +1,195 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Atom One Light (v9.16.2) */
|
| 2 |
+
/*
|
| 3 |
+
|
| 4 |
+
Atom One Light by Daniel Gamage
|
| 5 |
+
Original One Light Syntax theme from https://github.com/atom/one-light-syntax
|
| 6 |
+
|
| 7 |
+
base: #fafafa
|
| 8 |
+
mono-1: #383a42
|
| 9 |
+
mono-2: #686b77
|
| 10 |
+
mono-3: #a0a1a7
|
| 11 |
+
hue-1: #0184bb
|
| 12 |
+
hue-2: #4078f2
|
| 13 |
+
hue-3: #a626a4
|
| 14 |
+
hue-4: #50a14f
|
| 15 |
+
hue-5: #e45649
|
| 16 |
+
hue-5-2: #c91243
|
| 17 |
+
hue-6: #986801
|
| 18 |
+
hue-6-2: #c18401
|
| 19 |
+
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
.hljs {
|
| 23 |
+
display: block;
|
| 24 |
+
overflow-x: auto;
|
| 25 |
+
padding: 0.5em;
|
| 26 |
+
color: #383a42;
|
| 27 |
+
background: #fafafa;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.hljs-comment,
|
| 31 |
+
.hljs-quote {
|
| 32 |
+
color: #a0a1a7;
|
| 33 |
+
font-style: italic;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.hljs-doctag,
|
| 37 |
+
.hljs-keyword,
|
| 38 |
+
.hljs-formula {
|
| 39 |
+
color: #a626a4;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.hljs-section,
|
| 43 |
+
.hljs-name,
|
| 44 |
+
.hljs-selector-tag,
|
| 45 |
+
.hljs-deletion,
|
| 46 |
+
.hljs-subst {
|
| 47 |
+
color: #e45649;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.hljs-literal {
|
| 51 |
+
color: #0184bb;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.hljs-string,
|
| 55 |
+
.hljs-regexp,
|
| 56 |
+
.hljs-addition,
|
| 57 |
+
.hljs-attribute,
|
| 58 |
+
.hljs-meta-string {
|
| 59 |
+
color: #50a14f;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.hljs-built_in,
|
| 63 |
+
.hljs-class .hljs-title {
|
| 64 |
+
color: #c18401;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.hljs-attr,
|
| 68 |
+
.hljs-variable,
|
| 69 |
+
.hljs-template-variable,
|
| 70 |
+
.hljs-type,
|
| 71 |
+
.hljs-selector-class,
|
| 72 |
+
.hljs-selector-attr,
|
| 73 |
+
.hljs-selector-pseudo,
|
| 74 |
+
.hljs-number {
|
| 75 |
+
color: #986801;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.hljs-symbol,
|
| 79 |
+
.hljs-bullet,
|
| 80 |
+
.hljs-link,
|
| 81 |
+
.hljs-meta,
|
| 82 |
+
.hljs-selector-id,
|
| 83 |
+
.hljs-title {
|
| 84 |
+
color: #4078f2;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.hljs-emphasis {
|
| 88 |
+
font-style: italic;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
.hljs-strong {
|
| 92 |
+
font-weight: bold;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.hljs-link {
|
| 96 |
+
text-decoration: underline;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/* Atom One Dark (v9.16.2) scoped to .dark */
|
| 100 |
+
/*
|
| 101 |
+
|
| 102 |
+
Atom One Dark by Daniel Gamage
|
| 103 |
+
Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
|
| 104 |
+
|
| 105 |
+
base: #282c34
|
| 106 |
+
mono-1: #abb2bf
|
| 107 |
+
mono-2: #818896
|
| 108 |
+
mono-3: #5c6370
|
| 109 |
+
hue-1: #56b6c2
|
| 110 |
+
hue-2: #61aeee
|
| 111 |
+
hue-3: #c678dd
|
| 112 |
+
hue-4: #98c379
|
| 113 |
+
hue-5: #e06c75
|
| 114 |
+
hue-5-2: #be5046
|
| 115 |
+
hue-6: #d19a66
|
| 116 |
+
hue-6-2: #e6c07b
|
| 117 |
+
|
| 118 |
+
*/
|
| 119 |
+
|
| 120 |
+
.dark .hljs {
|
| 121 |
+
display: block;
|
| 122 |
+
overflow-x: auto;
|
| 123 |
+
padding: 0.5em;
|
| 124 |
+
color: #abb2bf;
|
| 125 |
+
background: #282c34;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.dark .hljs-comment,
|
| 129 |
+
.dark .hljs-quote {
|
| 130 |
+
color: #5c6370;
|
| 131 |
+
font-style: italic;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
.dark .hljs-doctag,
|
| 135 |
+
.dark .hljs-keyword,
|
| 136 |
+
.dark .hljs-formula {
|
| 137 |
+
color: #c678dd;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.dark .hljs-section,
|
| 141 |
+
.dark .hljs-name,
|
| 142 |
+
.dark .hljs-selector-tag,
|
| 143 |
+
.dark .hljs-deletion,
|
| 144 |
+
.dark .hljs-subst {
|
| 145 |
+
color: #e06c75;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
.dark .hljs-literal {
|
| 149 |
+
color: #56b6c2;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.dark .hljs-string,
|
| 153 |
+
.dark .hljs-regexp,
|
| 154 |
+
.dark .hljs-addition,
|
| 155 |
+
.dark .hljs-attribute,
|
| 156 |
+
.dark .hljs-meta-string {
|
| 157 |
+
color: #98c379;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.dark .hljs-built_in,
|
| 161 |
+
.dark .hljs-class .hljs-title {
|
| 162 |
+
color: #e6c07b;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.dark .hljs-attr,
|
| 166 |
+
.dark .hljs-variable,
|
| 167 |
+
.dark .hljs-template-variable,
|
| 168 |
+
.dark .hljs-type,
|
| 169 |
+
.dark .hljs-selector-class,
|
| 170 |
+
.dark .hljs-selector-attr,
|
| 171 |
+
.dark .hljs-selector-pseudo,
|
| 172 |
+
.dark .hljs-number {
|
| 173 |
+
color: #d19a66;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
.dark .hljs-symbol,
|
| 177 |
+
.dark .hljs-bullet,
|
| 178 |
+
.dark .hljs-link,
|
| 179 |
+
.dark .hljs-meta,
|
| 180 |
+
.dark .hljs-selector-id,
|
| 181 |
+
.dark .hljs-title {
|
| 182 |
+
color: #61aeee;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
.dark .hljs-emphasis {
|
| 186 |
+
font-style: italic;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
.dark .hljs-strong {
|
| 190 |
+
font-weight: bold;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
.dark .hljs-link {
|
| 194 |
+
text-decoration: underline;
|
| 195 |
+
}
|
src/styles/main.css
CHANGED
|
@@ -59,6 +59,10 @@
|
|
| 59 |
.prose strong {
|
| 60 |
@apply font-medium;
|
| 61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
.katex-display {
|
|
|
|
| 59 |
.prose strong {
|
| 60 |
@apply font-medium;
|
| 61 |
}
|
| 62 |
+
|
| 63 |
+
.prose pre {
|
| 64 |
+
@apply border-[0.5px] bg-white text-gray-600 dark:border-gray-700 dark:!bg-gray-900 dark:bg-inherit dark:text-inherit;
|
| 65 |
+
}
|
| 66 |
}
|
| 67 |
|
| 68 |
.katex-display {
|