Skip to content

Commit 7b93399

Browse files
committed
Add styling for Jac and Python code block differentiation
1 parent 4e0cd3e commit 7b93399

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

docs/extra.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,87 @@
136136
border: 1px solid var(--border);
137137
}
138138

139+
/* ── Language identity: distinguish Jac from Python code blocks ──
140+
Works without any markup changes: `pygments_lang_class: true` stamps each
141+
rendered fence with `language-jac` / `language-python` on the .highlight
142+
wrapper. Jac gets the Jaseci-orange identity; Python stays neutral. */
143+
144+
/* Static (non-interactive) blocks: accent left border + corner badge */
145+
.md-typeset .highlight.language-jac,
146+
.md-typeset .highlight.language-python {
147+
position: relative;
148+
border-left: 3px solid var(--border);
149+
border-radius: 4px;
150+
}
151+
.md-typeset .highlight.language-jac {
152+
border-left-color: var(--primary);
153+
}
154+
155+
.md-typeset .highlight.language-jac::before,
156+
.md-typeset .highlight.language-python::before {
157+
position: absolute;
158+
top: 0;
159+
right: 0;
160+
z-index: 1;
161+
font: 600 0.62rem/1 var(--font-family-code);
162+
letter-spacing: 0.08em;
163+
padding: 0.3rem 0.5rem;
164+
border-bottom-left-radius: 4px;
165+
pointer-events: none;
166+
}
167+
.md-typeset .highlight.language-jac::before {
168+
content: "JAC";
169+
color: var(--primary);
170+
background: var(--md-accent-bg-color);
171+
}
172+
.md-typeset .highlight.language-python::before {
173+
content: "PY";
174+
color: var(--text-muted);
175+
background: rgba(255, 255, 255, 0.04);
176+
}
177+
178+
/* Make room for the badge: nudge Material's copy button left of it */
179+
.md-typeset .highlight.language-jac > .md-clipboard,
180+
.md-typeset .highlight.language-python > .md-clipboard {
181+
right: 2.6rem;
182+
}
183+
184+
/* Interactive blocks already carry a toolbar + Monaco editor, so they don't
185+
need the overlay badge. Identity is marked on the wrapper border (see the
186+
.code-block component rule below); here we just suppress the inner static
187+
treatment to avoid doubling up. */
188+
.code-block .highlight.language-jac,
189+
.code-block .highlight.language-python {
190+
border-left: none;
191+
border-radius: 0;
192+
}
193+
.code-block .highlight.language-jac::before,
194+
.code-block .highlight.language-python::before {
195+
display: none;
196+
}
197+
.code-block .highlight.language-jac > .md-clipboard,
198+
.code-block .highlight.language-python > .md-clipboard {
199+
right: 0.5rem;
200+
}
201+
139202
/* ── Jac Code Block Component ── */
140203
.code-block {
141204
margin: 1.2em 0;
142205
padding: 0;
143206
background: #0d1117;
144207
color: #c9d1d9;
145208
border: 1px solid #21262d;
209+
border-left: 3px solid var(--border);
146210
border-radius: 6px;
147211
overflow: hidden;
148212
transition: border-color 0.2s ease, box-shadow 0.2s ease;
149213
}
150214

215+
/* Jac identity on interactive blocks (Python interactive blocks stay neutral) */
216+
.code-block[data-lang="jac"] {
217+
border-left-color: var(--primary);
218+
}
219+
151220
.code-block.jcb-running {
152221
border-color: #f0883e;
153222
}

0 commit comments

Comments
 (0)