Skip to content

Commit 11fd8d7

Browse files
committed
Collapsible Blocks Feature added
1 parent 1aa93ff commit 11fd8d7

5 files changed

Lines changed: 95 additions & 1 deletion

File tree

USAGEGUIDE.adoc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,33 @@ NOTE: Highlighted text for note Callout
5959

6060
WARNING: Highlighted text for warning Callout
6161

62+
=== Collapsible blocks (Deep dive / Hint)
63+
64+
Use `[%collapsible]` on an *example* block so optional detail stays collapsed until the learner expands it. A title line starting with a dot (`.Title`) sets the clickable label (summary).
65+
66+
[source,asciidoc]
67+
----
68+
.Hint
69+
[%collapsible]
70+
====
71+
Optional extra detail for curious readers.
72+
====
73+
74+
.Deep dive: why this works
75+
[%collapsible]
76+
====
77+
Longer explanation, lists, or source blocks go here.
78+
====
79+
----
80+
81+
To start expanded instead of collapsed, use `[%collapsible%open]` on the example block.
82+
83+
Use *NOTE* and *WARNING* for short callouts everyone should read. Use collapsible blocks for longer hints or deep dives that would clutter the main lesson path.
84+
85+
Collapsible behavior applies to the **HTML site** from Antora. PDF output from `asciidoctor-pdf` is not interactive; readers typically see all block content without expand/collapse.
86+
87+
Live examples: link:./modules/chapter1/pages/collapsible-demo.adoc[Collapsible blocks demo].
88+
6289
Table without header row:
6390

6491
[cols="1,1"]
@@ -92,4 +119,5 @@ Table with header row:
92119
- link:./README.md[Getting started with a new training content repository]
93120
- link:./DEVSPACE.md[Development using devspace]
94121
- link:./modules/chapter1/pages/tabs-demo.adoc[Tabbed code blocks (Asciidoctor Tabs demo)]
122+
- link:./modules/chapter1/pages/collapsible-demo.adoc[Collapsible blocks (Deep dive / Hint demo)]
95123

modules/chapter1/nav.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
** xref:section1.adoc[]
33
** xref:section2.adoc[]
44
** xref:section3.adoc[]
5-
** xref:tabs-demo.adoc[]
5+
** xref:tabs-demo.adoc[]
6+
** xref:collapsible-demo.adoc[]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
= Collapsible blocks
2+
3+
This page demonstrates https://docs.asciidoctor.org/asciidoc/latest/blocks/collapsible/[collapsible example blocks^] in Antora: use them for optional *Hints*, *Deep dives*, or other detail that should not block the main lesson flow.
4+
5+
No extra Antora extension is required; `[%collapsible]` is built into Asciidoctor.
6+
7+
== Hint (collapsed by default)
8+
9+
.Hint
10+
[%collapsible]
11+
====
12+
Try the exercise first; open this only if you are stuck.
13+
14+
* Check that your environment variables are set.
15+
* Re-read the previous section on configuration.
16+
====
17+
18+
== Deep dive (collapsed by default)
19+
20+
.Deep dive: how the pipeline stages relate
21+
[%collapsible]
22+
====
23+
The build runs *validate*, then *compile*, then *package*. Skipping a stage can leave artifacts out of date; that is why CI always runs the full chain.
24+
25+
[source,bash]
26+
----
27+
./gradlew clean build
28+
----
29+
====
30+
31+
== Starts expanded
32+
33+
.Optional context
34+
[%collapsible%open]
35+
====
36+
This block uses `[%collapsible%open]` so it is expanded on first load. Use sparingly when the extra context is still optional but you want it visible by default.
37+
====
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Supplemental styling for Asciidoctor [%collapsible] example blocks (HTML details/summary) */
2+
3+
.sectionbody > details {
4+
margin: 0 0 1.25em;
5+
border: 1px solid #ccc;
6+
border-radius: 3px;
7+
overflow: hidden;
8+
}
9+
10+
.sectionbody > details > summary.title {
11+
padding: 0.5em 0.75em;
12+
cursor: pointer;
13+
font-weight: 600;
14+
list-style: none;
15+
}
16+
17+
.sectionbody > details > summary.title::-webkit-details-marker {
18+
display: none;
19+
}
20+
21+
.sectionbody > details[open] > summary.title {
22+
border-bottom: 1px solid #ccc;
23+
}
24+
25+
.sectionbody > details > .content {
26+
padding: 0.75em 1em;
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
<link rel="stylesheet" href="{{{uiRootPath}}}/css/site.css">
22
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/tabs.css">
3+
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/collapsible.css">

0 commit comments

Comments
 (0)