Skip to content

Commit 20db860

Browse files
committed
feat: Add code block styling and highlight.js theme for playground
- Add CSS for code blocks in preview (pre, code elements) - Add highlight.js syntax highlighting theme with light/dark mode support - Style extension toggles layout
1 parent d17ea6c commit 20db860

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

docs/.vitepress/theme/custom.css

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,94 @@
141141
color: var(--vp-c-text-1);
142142
font-size: 14px;
143143
}
144+
145+
.djot-playground .extension-toggles {
146+
display: flex;
147+
flex-wrap: wrap;
148+
gap: 0.75rem;
149+
}
150+
151+
/* Code blocks in playground preview */
152+
.djot-playground .preview pre {
153+
background: var(--vp-code-block-bg);
154+
border-radius: 8px;
155+
padding: 1rem;
156+
overflow-x: auto;
157+
margin: 1rem 0;
158+
}
159+
160+
.djot-playground .preview pre code {
161+
font-family: var(--vp-font-family-mono);
162+
font-size: 14px;
163+
line-height: 1.6;
164+
color: var(--vp-c-text-1);
165+
}
166+
167+
.djot-playground .preview code:not(pre code) {
168+
background: var(--vp-code-block-bg);
169+
padding: 0.2em 0.4em;
170+
border-radius: 4px;
171+
font-family: var(--vp-font-family-mono);
172+
font-size: 0.9em;
173+
}
174+
175+
/* highlight.js theme for playground */
176+
.djot-playground .preview .hljs-keyword,
177+
.djot-playground .preview .hljs-selector-tag,
178+
.djot-playground .preview .hljs-title,
179+
.djot-playground .preview .hljs-section,
180+
.djot-playground .preview .hljs-doctag,
181+
.djot-playground .preview .hljs-name,
182+
.djot-playground .preview .hljs-strong {
183+
color: var(--vp-c-brand-1);
184+
font-weight: 600;
185+
}
186+
187+
.djot-playground .preview .hljs-string,
188+
.djot-playground .preview .hljs-attr {
189+
color: #22863a;
190+
}
191+
192+
.dark .djot-playground .preview .hljs-string,
193+
.dark .djot-playground .preview .hljs-attr {
194+
color: #7ee787;
195+
}
196+
197+
.djot-playground .preview .hljs-variable,
198+
.djot-playground .preview .hljs-template-variable,
199+
.djot-playground .preview .hljs-type,
200+
.djot-playground .preview .hljs-selector-class,
201+
.djot-playground .preview .hljs-selector-attr,
202+
.djot-playground .preview .hljs-selector-pseudo,
203+
.djot-playground .preview .hljs-number {
204+
color: #e36209;
205+
}
206+
207+
.dark .djot-playground .preview .hljs-variable,
208+
.dark .djot-playground .preview .hljs-template-variable,
209+
.dark .djot-playground .preview .hljs-type,
210+
.dark .djot-playground .preview .hljs-selector-class,
211+
.dark .djot-playground .preview .hljs-selector-attr,
212+
.dark .djot-playground .preview .hljs-selector-pseudo,
213+
.dark .djot-playground .preview .hljs-number {
214+
color: #ffa657;
215+
}
216+
217+
.djot-playground .preview .hljs-comment,
218+
.djot-playground .preview .hljs-quote {
219+
color: #6a737d;
220+
font-style: italic;
221+
}
222+
223+
.dark .djot-playground .preview .hljs-comment,
224+
.dark .djot-playground .preview .hljs-quote {
225+
color: #8b949e;
226+
}
227+
228+
.djot-playground .preview .hljs-built_in {
229+
color: #005cc5;
230+
}
231+
232+
.dark .djot-playground .preview .hljs-built_in {
233+
color: #79c0ff;
234+
}

0 commit comments

Comments
 (0)