authorgravatar for manlio.perillo@gmail.comManlio Perillo <manlio.perillo@gmail.com> 2022-12-09 17:14:18+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-12-19 21:51:23+02:00
log3542dbf0ea5bc1ddb1c5e1c856745dc07e6c0a18
treea134956f4302054a14131d0d90e4eb3d0241e21a
parent3db8cffa3b383011471f425983a7e98ad8a46aa5

langref: add section numbers

When reading a document with nested sections, it is not easy to discover the depth of the current section. Add support for nested section numbers, from the h2 to the h4 heading, in the format "lv1. ", "lv1.lv2. ", "lv1.lv2.lv3. ". The "Zig Version" and "Table of Content" sections are excluded. The section numbers are implemented in CSS, with the CSS rules declared inside a @media rule. Currently the @media rule targets all media.

1 files changed, 34 insertions(+), 0 deletions(-)

doc/langref.html.in+34
......@@ -300,6 +300,40 @@
300300 color: #fff;
301301 }
302302 }
303
304 @media all {
305 main {
306 counter-reset: section-2;
307 }
308 h2 {
309 counter-reset: section-3;
310 }
311 h2::before {
312 counter-increment: section-2;
313 content: counter(section-2) ". ";
314 font-weight: normal;
315 }
316 h3 {
317 counter-reset: section-4;
318 }
319 h3::before {
320 counter-increment: section-3;
321 content: counter(section-2) "." counter(section-3) ". ";
322 font-weight: normal;
323 }
324 h4::before {
325 counter-increment: section-4;
326 content: counter(section-2) "." counter(section-3) "." counter(section-4) ". ";
327 font-weight: normal;
328 }
329 #zig-version::before {
330 content: "";
331 }
332 #table-of-contents::before {
333 content: "";
334 }
335 }
336 }
303337 </style>
304338</head>
305339<body>