|
1 | 1 | <!-- MDsveXContentRenderer.svelte --> |
2 | 2 | <script lang="ts"> |
3 | | - import { onMount, tick } from 'svelte'; |
4 | | - import { afterNavigate } from '$app/navigation'; |
5 | | - import mermaid from 'mermaid'; |
6 | | - import hljs from 'highlight.js'; // Import highlight.js |
| 3 | + import { onMount, tick } from "svelte"; |
| 4 | + import { afterNavigate } from "$app/navigation"; |
| 5 | + import mermaid from "mermaid"; |
| 6 | + import hljs from "highlight.js"; // Import highlight.js |
7 | 7 | // import 'highlight.js/styles/nnfx-dark.min.css'; // Import a default style for highlight.js |
8 | | - import 'highlight.js/styles/default.css'; |
| 8 | + import "highlight.js/styles/default.css"; |
9 | 9 | // import 'highlight.js/styles/github-dark.css'; |
10 | | - import { browser } from '$app/environment'; |
| 10 | + import { browser } from "$app/environment"; |
11 | 11 |
|
12 | 12 | export let content: string; |
13 | 13 |
|
|
17 | 17 | mermaid.initialize({ startOnLoad: false }); |
18 | 18 | await tick(); // Ensure DOM is updated |
19 | 19 | mermaid.run({ |
20 | | - querySelector: '.mermaid' // Render all elements with the mermaid class |
| 20 | + querySelector: ".mermaid", // Render all elements with the mermaid class |
21 | 21 | }); |
22 | 22 | }; |
23 | 23 |
|
24 | 24 | const updateHighlightTheme = () => { |
25 | 25 | if (browser) { |
26 | | - const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches; |
27 | | - document.documentElement.classList.toggle('theme-dark', isDarkMode); |
28 | | - document.documentElement.classList.toggle('theme-light', !isDarkMode); |
| 26 | + const isDarkMode = window.matchMedia( |
| 27 | + "(prefers-color-scheme: dark)", |
| 28 | + ).matches; |
| 29 | + document.documentElement.classList.toggle("theme-dark", isDarkMode); |
| 30 | + document.documentElement.classList.toggle("theme-light", !isDarkMode); |
29 | 31 | hljs.highlightAll(); |
30 | 32 | } |
31 | 33 | }; |
|
117 | 119 | @apply flex list-none items-center py-2; |
118 | 120 | } |
119 | 121 |
|
120 | | - :global(.task-list-item input[type='checkbox']), |
121 | | - :global(input[type='checkbox']) { |
| 122 | + :global(.task-list-item input[type="checkbox"]), |
| 123 | + :global(input[type="checkbox"]) { |
122 | 124 | @apply mr-2 h-4 w-4 cursor-pointer appearance-none border bg-white transition-all duration-200 ease-in-out; |
123 | 125 | position: relative; |
124 | 126 | } |
125 | 127 |
|
126 | | - :global(.task-list-item input[type='checkbox']:checked), |
127 | | - :global(input[type='checkbox']:checked) { |
| 128 | + :global(.task-list-item input[type="checkbox"]:checked), |
| 129 | + :global(input[type="checkbox"]:checked) { |
128 | 130 | @apply border-blue-500 bg-blue-500; |
129 | 131 | } |
130 | 132 |
|
131 | | - :global(.task-list-item input[type='checkbox']:checked::before), |
132 | | - :global(input[type='checkbox']:checked::before) { |
133 | | - content: '\2713'; |
| 133 | + :global(.task-list-item input[type="checkbox"]:checked::before), |
| 134 | + :global(input[type="checkbox"]:checked::before) { |
| 135 | + content: "\2713"; |
134 | 136 | @apply absolute text-xs font-bold text-white; |
135 | 137 | top: 50%; |
136 | 138 | left: 50%; |
137 | 139 | transform: translate(-50%, -50%); |
138 | 140 | } |
139 | 141 |
|
140 | | - :global(.task-list-item input[type='checkbox']:disabled), |
141 | | - :global(input[type='checkbox']:disabled) { |
| 142 | + :global(.task-list-item input[type="checkbox"]:disabled), |
| 143 | + :global(input[type="checkbox"]:disabled) { |
142 | 144 | @apply cursor-not-allowed border-carbongray-800; |
143 | 145 | } |
144 | 146 |
|
145 | | - :global(.task-list-item input[type='checkbox']:disabled:checked), |
146 | | - :global(input[type='checkbox']:disabled:checked) { |
| 147 | + :global(.task-list-item input[type="checkbox"]:disabled:checked), |
| 148 | + :global(input[type="checkbox"]:disabled:checked) { |
147 | 149 | @apply border-carbongray-700 bg-carbongray-100 dark:bg-carbongray-600; |
148 | 150 | } |
149 | 151 |
|
150 | | - :global(.task-list-item input[type='checkbox']:disabled:checked::before), |
151 | | - :global(input[type='checkbox']:disabled:checked::before) { |
| 152 | + :global(.task-list-item input[type="checkbox"]:disabled:checked::before), |
| 153 | + :global(input[type="checkbox"]:disabled:checked::before) { |
152 | 154 | @apply text-gray-500 dark:text-carbongray-100; |
153 | 155 | } |
154 | 156 |
|
155 | 157 | :global(.task-list-item), |
156 | | - :global(input[type='checkbox'] + *) { |
| 158 | + :global(input[type="checkbox"] + *) { |
157 | 159 | @apply select-none text-lg; |
158 | 160 | } |
159 | 161 |
|
160 | | - :global(.task-list-item input[type='checkbox']:disabled ~ *), |
161 | | - :global(input[type='checkbox']:disabled + *) { |
| 162 | + :global(.task-list-item input[type="checkbox"]:disabled ~ *), |
| 163 | + :global(input[type="checkbox"]:disabled + *) { |
162 | 164 | @apply text-gray-400; |
163 | 165 | } |
164 | 166 |
|
|
169 | 171 |
|
170 | 172 | /* Unordered list styles with centered dot */ |
171 | 173 | :global(ul > li::before) { |
172 | | - content: ''; |
173 | | - @apply absolute left-2 top-[0.7em] h-2 w-2 rounded-full bg-carbonblue-500; |
| 174 | + content: ""; |
| 175 | + @apply absolute left-2 top-[35%] h-2 w-2 rounded-full bg-carbonblue-500; |
174 | 176 | } |
175 | 177 |
|
176 | 178 | /* Ordered list styles */ |
|
206 | 208 | content: none; |
207 | 209 | } |
208 | 210 |
|
209 | | - :global(.task-list-item input[type='checkbox']) { |
| 211 | + :global(.task-list-item input[type="checkbox"]) { |
210 | 212 | @apply mr-2 mt-1; |
211 | 213 | } |
212 | 214 |
|
213 | 215 | /* Checkbox styles */ |
214 | | - :global(.task-list-item input[type='checkbox']), |
215 | | - :global(input[type='checkbox']) { |
| 216 | + :global(.task-list-item input[type="checkbox"]), |
| 217 | + :global(input[type="checkbox"]) { |
216 | 218 | @apply h-4 w-4 cursor-pointer appearance-none rounded border border-gray-300 bg-white transition-all duration-200 ease-in-out; |
217 | 219 | position: relative; |
218 | 220 | } |
219 | 221 |
|
220 | | - :global(.task-list-item input[type='checkbox']:checked), |
221 | | - :global(input[type='checkbox']:checked) { |
| 222 | + :global(.task-list-item input[type="checkbox"]:checked), |
| 223 | + :global(input[type="checkbox"]:checked) { |
222 | 224 | @apply border-blue-500 bg-blue-500; |
223 | 225 | } |
224 | 226 |
|
225 | | - :global(.task-list-item input[type='checkbox']:checked::before), |
226 | | - :global(input[type='checkbox']:checked::before) { |
227 | | - content: '\2713'; |
| 227 | + :global(.task-list-item input[type="checkbox"]:checked::before), |
| 228 | + :global(input[type="checkbox"]:checked::before) { |
| 229 | + content: "\2713"; |
228 | 230 | @apply absolute text-xs font-bold text-white; |
229 | 231 | top: 50%; |
230 | 232 | left: 50%; |
231 | 233 | transform: translate(-50%, -50%); |
232 | 234 | } |
233 | 235 |
|
234 | | - :global(.task-list-item input[type='checkbox']:disabled), |
235 | | - :global(input[type='checkbox']:disabled) { |
| 236 | + :global(.task-list-item input[type="checkbox"]:disabled), |
| 237 | + :global(input[type="checkbox"]:disabled) { |
236 | 238 | @apply cursor-not-allowed border-gray-200 bg-gray-100; |
237 | 239 | } |
238 | 240 |
|
239 | | - :global(.task-list-item input[type='checkbox']:disabled:checked), |
240 | | - :global(input[type='checkbox']:disabled:checked) { |
| 241 | + :global(.task-list-item input[type="checkbox"]:disabled:checked), |
| 242 | + :global(input[type="checkbox"]:disabled:checked) { |
241 | 243 | @apply border-gray-300 bg-gray-300; |
242 | 244 | } |
243 | 245 |
|
244 | | - :global(.task-list-item input[type='checkbox']:disabled:checked::before), |
245 | | - :global(input[type='checkbox']:disabled:checked::before) { |
| 246 | + :global(.task-list-item input[type="checkbox"]:disabled:checked::before), |
| 247 | + :global(input[type="checkbox"]:disabled:checked::before) { |
246 | 248 | @apply text-white; |
247 | 249 | } |
248 | 250 | :global(img) { |
|
254 | 256 | } |
255 | 257 |
|
256 | 258 | :global(blockquote::before) { |
257 | | - content: ''; |
| 259 | + content: ""; |
258 | 260 | @apply absolute -left-8 -top-2 h-20 w-20 bg-carbongray-100 dark:bg-carbongray-600; /* Positioning, size, and color */ |
259 | 261 | mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none"><path d="M7.39762 10.3C7.39762 11.0733 7.14888 11.7 6.6514 12.18C6.15392 12.6333 5.52552 12.86 4.76621 12.86C3.84979 12.86 3.09047 12.5533 2.48825 11.94C1.91222 11.3266 1.62421 10.4467 1.62421 9.29999C1.62421 8.07332 1.96459 6.87332 2.64535 5.69999C3.35231 4.49999 4.33418 3.55332 5.59098 2.85999L6.4943 4.25999C5.81354 4.73999 5.26369 5.27332 4.84476 5.85999C4.45201 6.44666 4.19017 7.12666 4.05926 7.89999C4.29491 7.79332 4.56983 7.73999 4.88403 7.73999C5.61716 7.73999 6.21938 7.97999 6.69067 8.45999C7.16197 8.93999 7.39762 9.55333 7.39762 10.3ZM14.6242 10.3C14.6242 11.0733 14.3755 11.7 13.878 12.18C13.3805 12.6333 12.7521 12.86 11.9928 12.86C11.0764 12.86 10.3171 12.5533 9.71484 11.94C9.13881 11.3266 8.85079 10.4467 8.85079 9.29999C8.85079 8.07332 9.19117 6.87332 9.87194 5.69999C10.5789 4.49999 11.5608 3.55332 12.8176 2.85999L13.7209 4.25999C13.0401 4.73999 12.4903 5.27332 12.0713 5.85999C11.6786 6.44666 11.4168 7.12666 11.2858 7.89999C11.5215 7.79332 11.7964 7.73999 12.1106 7.73999C12.8437 7.73999 13.446 7.97999 13.9173 8.45999C14.3886 8.93999 14.6242 9.55333 14.6242 10.3Z" fill="currentColor"/></svg>'); |
260 | 262 | } |
|
0 commit comments