From 3542dbf0ea5bc1ddb1c5e1c856745dc07e6c0a18 Mon Sep 17 00:00:00 2001 From: Manlio Perillo Date: Fri, 9 Dec 2022 17:14:18 +0100 Subject: 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. --- doc/langref.html.in | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'doc') diff --git a/doc/langref.html.in b/doc/langref.html.in index 04755d00ec..7a3c96595c 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -300,6 +300,40 @@ color: #fff; } } + + @media all { + main { + counter-reset: section-2; + } + h2 { + counter-reset: section-3; + } + h2::before { + counter-increment: section-2; + content: counter(section-2) ". "; + font-weight: normal; + } + h3 { + counter-reset: section-4; + } + h3::before { + counter-increment: section-3; + content: counter(section-2) "." counter(section-3) ". "; + font-weight: normal; + } + h4::before { + counter-increment: section-4; + content: counter(section-2) "." counter(section-3) "." counter(section-4) ". "; + font-weight: normal; + } + #zig-version::before { + content: ""; + } + #table-of-contents::before { + content: ""; + } + } + } -- cgit v1.2.3