Skip to content

Commit 087859e

Browse files
authored
Remove toc sidebar when page-toclevels is -1 (#251)
At narrow page widths, when the main TOC is still visible, setting `:page-toclevel: -1` results in no in-page 'Contents' being displayed, but the HTML elements are still present, taking up width. This can produce inconsistent page appearance: - pages with no headings use the available width - pages with headings, but the 'Contents' section removed use the width minus the width of the `<aside>`. Note that this change has no effect on the page layout once the `<article>` (the main page content) reaches its maximum width.
1 parent f207f8d commit 087859e

File tree

3 files changed

+286
-2
lines changed

3 files changed

+286
-2
lines changed

preview-src/tables-no-toc.adoc

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
= Tables with no in-page Contents
2+
:nofooter:
3+
:page-ogtitle: This page uses the page-ogtitle attribute to generate a custom title for SEO meta
4+
:page-toclevels: -1
5+
6+
.No striping
7+
// Alternative to stripes attributes is
8+
// setting role "stripes-none" as [.stripes-none,cols="1,2"].
9+
[stripes=none,cols="1,2"]
10+
|===
11+
| Name | Description
12+
13+
| Asciidoctor
14+
| *Awesome* way to write documentation
15+
16+
| Micronaut
17+
| Low resource usage and fast startup micro services
18+
|===
19+
20+
.All rows
21+
// Alternative to stripes attributes is
22+
// setting role "stripes-all" as [.stripes-all,cols="1,2"].
23+
[stripes=all,cols="1,2"]
24+
|===
25+
| Name | Description
26+
27+
| Asciidoctor
28+
| *Awesome* way to write documentation
29+
30+
| Micronaut
31+
| Low resource usage and fast startup micro services
32+
|===
33+
34+
.Odd rows
35+
// Alternative to stripes attributes is
36+
// setting role "stripes-odd" as [.stripes-odd,cols="1,2"].
37+
[stripes=odd,cols="1,2"]
38+
|===
39+
| Name | Description
40+
41+
| Asciidoctor
42+
| *Awesome* way to write documentation
43+
44+
| Micronaut
45+
| Low resource usage and fast startup micro services
46+
|===
47+
48+
.Even rows (default)
49+
// Alternative to stripes attributes is
50+
// setting role "stripes-even" as [.stripes-even,cols="1,2"].
51+
[stripes=even,cols="1,2"]
52+
|===
53+
| Name | Description
54+
55+
| Asciidoctor
56+
| *Awesome* way to write documentation
57+
58+
| Micronaut
59+
| Low resource usage and fast startup micro services
60+
|===
61+
62+
.Hover
63+
[stripes=hover,cols="1,2"]
64+
|===
65+
| Name | Description
66+
67+
| Asciidoctor
68+
| *Awesome* way to write documentation
69+
70+
| Micronaut
71+
| Low resource usage and fast startup micro services
72+
|===
73+
74+
.No header
75+
[cols="1,2"]
76+
|===
77+
| Asciidoctor
78+
| *Awesome* way to write documentation
79+
80+
| Micronaut
81+
| Low resource usage and fast startup micro services
82+
|===
83+
84+
.Table with top and bottom frame (topbot)
85+
[frame="topbot"]
86+
|===
87+
| Name | Description
88+
89+
| Asciidoctor
90+
| Awesome way to write documentation
91+
92+
|===
93+
94+
95+
.Table with no frame (none)
96+
[frame="none"]
97+
|===
98+
| Name | Description
99+
100+
| Asciidoctor
101+
| Awesome way to write documentation
102+
103+
|===
104+
105+
106+
.Table with only sides frame (sides)
107+
[frame="sides"]
108+
|===
109+
| Name | Description
110+
111+
| Asciidoctor
112+
| Awesome way to write documentation
113+
114+
|===
115+
116+
117+
.Table with default frame (all)
118+
[frame="all"]
119+
|===
120+
| Name | Description
121+
122+
| Asciidoctor
123+
| Awesome way to write documentation
124+
125+
|===
126+
127+
.Table with no grid (none)
128+
[grid="none", frame="none"]
129+
|===
130+
| Name | Description
131+
132+
| Asciidoctor
133+
| Awesome way to write documentation
134+
135+
|===
136+
137+
.Table with only columns grid (cols)
138+
[grid="cols", frame="none"]
139+
|===
140+
| Name | Description
141+
142+
| Asciidoctor
143+
| Awesome way to write documentation
144+
145+
|===
146+
147+
.Table with only rows grid (rows)
148+
[grid="rows", frame="none"]
149+
|===
150+
| Name | Description
151+
152+
| Asciidoctor
153+
| Awesome way to write documentation
154+
155+
|===
156+
157+
.Table with default rows and columns grid (all)
158+
[grid="all", frame="none"]
159+
|===
160+
| Name | Description
161+
162+
| Asciidoctor
163+
| Awesome way to write documentation
164+
165+
|===
166+
167+
== Setup and Cypher Refresher
168+
169+
[frame="none", cols="^.^,<.^"]
170+
|===
171+
a|image::sandbox.png[Neo4j Sandbox,width=500,align=center]
172+
a|
173+
Neo4j Sandbox is a hosted Neo4j tool that allows you to run private instances of Neo4j without having to install Neo4j locally. You can choose Neo4j Sandbox usecases that come pre-loaded with datasets and your Neo4j Sandbox instances can be accessed over the internet, making them useful for building sample applications. While Neo4j Browser is the primary way to interact with Neo4j instances hosted by Neo4j Sandbox, for this course you will also connect your sandbox instance to a simple web application.
174+
|===
175+
176+
== Breaking long text
177+
178+
Long parameter, var, or option names shouldn't wrap
179+
180+
.Results
181+
[opts="header",cols="1,1,6"]
182+
|===
183+
| Name | Type | Description
184+
| nodes | int | The number of nodes considered.
185+
| writeProperty | string | The property name written back to.
186+
| createMillis | int | Milliseconds for loading data.
187+
| computeMillis | int | Milliseconds for running the algorithm.
188+
| writeMillis | int | Milliseconds for writing result data back.
189+
| centralityDistribution | Map | Map containing min, max, mean as well as p50, p75, p90, p95, p99 and p999 percentile values of centrality values.
190+
|===
191+
192+
In case a value or long string is used in a link but not formatted as code
193+
194+
|===
195+
| text | link
196+
| text | link:example.com[bolt.connections,bolt.messages_received,bolt.messages_started,dbms.pool.bolt.free,*dbms.pool.bolt.total_size,*dbms.pool.bolt.total_used,*dbms.pool.bolt.used_heap,*causal_clustering.core.is_leader,*causal_clustering.core.last_leader_message,*causal_clustering.core.replication_attempt]
197+
|===
198+
199+
The next table includes a large codeblock, which needs to wrap
200+
201+
.metrics.filter
202+
[cols="<1s,<4"]
203+
|===
204+
|Description
205+
a|Specifies which metrics should be enabled by using a comma separated list of globbing patterns. Only the metrics matching the filter will be enabled. For example '*check_point*,neo4j.page_cache.evictions' will enable any checkpoint metrics and the pagecache eviction metric.
206+
|Valid values
207+
a|metrics.filter, a ',' separated list with elements of type 'A simple globbing pattern that can use '*' and '?'.'.
208+
|Default value
209+
m|*bolt.connections*,*bolt.messages_received*,*bolt.messages_started*,*dbms.pool.bolt.free,*dbms.pool.bolt.total_size,*dbms.pool.bolt.total_used,*dbms.pool.bolt.used_heap,*causal_clustering.core.is_leader,*causal_clustering.core.last_leader_message,*causal_clustering.core.replication_attempt,*causal_clustering.core.replication_fail,*check_point.duration,*check_point.total_time,*cypher.replan_events,*ids_in_use.node,*ids_in_use.property,*ids_in_use.relationship,*pool.transaction.*.total_used,*pool.transaction.*.used_heap,*pool.transaction.*.used_native,*store.size*,*transaction.active_read,*transaction.active_write,*transaction.committed*,*transaction.last_committed_tx_id,*transaction.peak_concurrent,*transaction.rollbacks*,*page_cache.hit*,*page_cache.page_faults,*page_cache.usage_ratio,*vm.file.descriptors.count,*vm.gc.time.*,*vm.heap.used,*vm.memory.buffer.direct.used,*vm.memory.pool.g1_eden_space,*vm.memory.pool.g1_old_gen,*vm.pause_time,*vm.thread*
210+
211+
|===
212+
213+
== Table Text Wrap
214+
215+
Tables showing word-break behavior
216+
217+
=== Text, links, and inline code
218+
219+
[opts="header",cols="1,1,1m,1,8"]
220+
|===
221+
| Name | Type | Default | Optional | Description
222+
| <<table-link-target,nodeLabels>> | List of String | ['*'] | yes | Filter the named graph using the given node labels.
223+
| <<table-link-target,relationshipTypes>> | List of String | ['*'] | yes | Filter the named graph using the given relationship types.
224+
| <<table-link-target,concurrency>> | Integer | 4 | yes | The number of concurrent threads used for running the algorithm.
225+
|===
226+
227+
[opts="header",cols="1,1,1m,1,8"]
228+
|===
229+
| Name | Type | Default | Optional | Description
230+
| `<<common-configuration-node-labels,nodeLabels>>` | List of String | ['*'] | yes | Filter the named graph using the given node labels.
231+
| `<<common-configuration-relationship-types,relationshipTypes>>` | List of String | ['*'] | yes | Filter the named graph using the given relationship types.
232+
| `<<common-configuration-concurrency,concurrency>>` | Integer | 4 | yes | The number of concurrent threads used for running the algorithm.
233+
|===
234+
235+
[opts="header",cols="1,1,1m,1,8"]
236+
|===
237+
| Name | Type | Default | Optional | Description
238+
| `nodeLabels` | List of String | ['*'] | yes | Filter the named graph using the given node labels.
239+
| `relationshipTypes` | List of String | ['*'] | yes | Filter the named graph using the given relationship types.
240+
| `concurrency` | Integer | 4 | yes | The number of concurrent threads used for running the algorithm.
241+
|===
242+
243+
=== Table with better column widths:
244+
245+
[opts="header",cols="2,1,1m,1,5"]
246+
|===
247+
| Name | Type | Default | Optional | Description
248+
| <<table-link-target,nodeLabels>> | List of String | ['*'] | yes | Filter the named graph using the given node labels.
249+
| <<table-link-target,relationshipTypes>> | List of String | ['*'] | yes | Filter the named graph using the given relationship types.
250+
| <<table-link-target,concurrency>> | Integer | 4 | yes | The number of concurrent threads used for running the algorithm.
251+
|===
252+
253+
=== Tables with `role=no-break`:
254+
255+
[role="no-break",opts="header",cols="1,1,1m,1,8"]
256+
|===
257+
| Name | Type | Default | Optional | Description
258+
| <<common-configuration-node-labels,nodeLabels>> | List of String | ['*'] | yes | Filter the named graph using the given node labels.
259+
| <<common-configuration-relationship-types,relationshipTypes>> | List of String | ['*'] | yes | Filter the named graph using the given relationship types.
260+
| <<common-configuration-concurrency,concurrency>> | Integer | 4 | yes | The number of concurrent threads used for running the algorithm.
261+
|===
262+
263+
[role="no-break",opts="header",cols="1,1,1m,1,8"]
264+
|===
265+
| Name | Type | Default | Optional | Description
266+
| `<<common-configuration-node-labels,nodeLabels>>` | List of String | ['*'] | yes | Filter the named graph using the given node labels.
267+
| `<<common-configuration-relationship-types,relationshipTypes>>` | List of String | ['*'] | yes | Filter the named graph using the given relationship types.
268+
| `<<common-configuration-concurrency,concurrency>>` | Integer | 4 | yes | The number of concurrent threads used for running the algorithm.
269+
|===
270+
271+
[role="no-break",opts="header",cols="1,1,1m,1,8"]
272+
|===
273+
| Name | Type | Default | Optional | Description
274+
| `nodeLabels` | List of String | ['*'] | yes | Filter the named graph using the given node labels.
275+
| `relationshipTypes` | List of String | ['*'] | yes | Filter the named graph using the given relationship types.
276+
| `concurrency` | Integer | 4 | yes | The number of concurrent threads used for running the algorithm.
277+
|===
278+
279+
== table link target
280+
281+
A section for table links to point to

preview-src/ui-model.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ page:
195195
- content: Tables
196196
url: tables.html
197197
urlType: internal
198+
- content: Tables (no toc)
199+
url: tables-no-toc.html
200+
urlType: internal
198201
- content: Tables (No Captions)
199202
url: tables-no-captions.html
200203
urlType: internal

src/js/02-on-this-page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
if (!sidebar) return
77
if (document.querySelector('body.-toc')) return sidebar.parentNode.removeChild(sidebar)
88
var levels = parseInt(sidebar.dataset.levels || 2)
9-
if (levels < 0) return
9+
if (levels < 0) return sidebar.parentNode.removeChild(sidebar) // remove the sidebar if :page-toclevels: -1
1010

1111
var article = document.querySelector('article.doc')
1212
var selectors = document.querySelector('.nav-container .selectors')
1313
var selectorsHeight = selectors ? selectors.getBoundingClientRect().height : 0
1414
var headings
1515
var headingSelector = []
1616
for (var l = 0; l <= levels; l++) headingSelector.push(l ? '.sect' + l + '>h' + (l + 1) + '[id]' : 'h1[id].sect0')
17-
if (!(headings = find(headingSelector.join(','), article)).length) return sidebar.parentNode.removeChild(sidebar)
17+
if (!(headings = find(headingSelector.join(','), article)).length) return sidebar.parentNode.removeChild(sidebar) // remove sidebar if there are no headings
1818

1919
var lastActiveFragment
2020
var links = {}

0 commit comments

Comments
 (0)