Skip to content

Commit 374733c

Browse files
committed
Make book collapsed code a bit less intrusive
This makes the collapsed code indicator a bit less intrusive to the overall flow of the tutorial with some styling.
1 parent c5e9e22 commit 374733c

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

docs/book/theme/css/general.css

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,47 @@ label[for="markers-summarize"]::before {
353353
display: flex;
354354
flex-direction: column;
355355
}
356+
357+
/* details elements (not markers) */
358+
main > details.collapse-code > summary {
359+
font-size: 80%;
360+
opacity: 0.7;
361+
}
362+
363+
main > details.collapse-code > summary::after {
364+
content: " (hidden)";
365+
}
366+
367+
/* diagrams */
368+
369+
.diagrams {
370+
display: flex;
371+
flex-direction: row;
372+
align-items: center;
373+
}
374+
375+
.diagrams > * {
376+
margin-left: 1em;
377+
margin-right: 1em;
378+
font-size: 160%;
379+
font-weight: bold;
380+
}
381+
382+
.diagrams object, .diagrams svg {
383+
max-width: 100%;
384+
max-height: 10em; /* force svg height to behave */
385+
}
386+
387+
.diagrams path, .diagrams polyline, .diagrams circle {
388+
stroke: var(--fg);
389+
}
390+
391+
.diagrams path.text {
392+
fill: var(--fg);
393+
stroke: none;
394+
}
395+
396+
.diagrams path.text.invert {
397+
fill: black;
398+
stroke: none;
399+
}

docs/book/utils/litgo/literate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func extractContents(contents []byte, path string) (string, error) {
183183

184184
for _, pair := range pairs {
185185
if pair.collapse != "" {
186-
out.WriteString("<details><summary>")
186+
out.WriteString("<details class=\"collapse-code\"><summary>")
187187
out.WriteString(pair.collapse)
188188
out.WriteString("</summary>")
189189
}

0 commit comments

Comments
 (0)