From 957d05d16bc80cef14c2e9fe31b6b847e698f9d1 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 25 Jun 2023 12:29:56 -0700 Subject: fix(docs): too much whitespace around
 blocks #24151

Problem:
In the generated docs HTML there is too much whitespace before/after `
`
blocks.
- In the old layout (fixed-width), all text in `.old-help-para` is formatted as
  `white-space:pre`.
- In the new layout, when `
` is at the end of a `
`, the margins of both are redundant, causing too much space. Solution: - In the old layout, always remove `
` margin.
- In the new layout, disable `
` margin if it is the last child.
---
 scripts/gen_help_html.lua | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'scripts/gen_help_html.lua')

diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua
index c89a7c70da..f741efcaeb 100644
--- a/scripts/gen_help_html.lua
+++ b/scripts/gen_help_html.lua
@@ -944,6 +944,7 @@ local function gen_css(fname)
       padding-top: 10px;
       padding-bottom: 10px;
     }
+
     .old-help-para {
       padding-top: 10px;
       padding-bottom: 10px;
@@ -953,6 +954,12 @@ local function gen_css(fname)
       font-size: 16px;
       font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
     }
+    .old-help-para pre {
+      /* All text in .old-help-para is formatted as "white-space:pre" so text following 
 is
+         already visually separated by the linebreak. */
+      margin-bottom: 0;
+    }
+
     a.help-tag, a.help-tag:focus, a.help-tag:hover {
       color: inherit;
       text-decoration: none;
@@ -1006,6 +1013,9 @@ local function gen_css(fname)
       font-size: 16px;
       margin-top: 10px;
     }
+    pre:last-child {
+      margin-bottom: 0;
+    }
     pre:hover,
     .help-heading:hover {
       overflow: visible;
-- 
cgit