Skip to content

Commit 957d05d

Browse files
authored
fix(docs): too much whitespace around <pre> blocks neovim#24151
Problem: In the generated docs HTML there is too much whitespace before/after `<pre>` blocks. - In the old layout (fixed-width), all text in `.old-help-para` is formatted as `white-space:pre`. - In the new layout, when `<pre>` is at the end of a `<div>`, the margins of both are redundant, causing too much space. Solution: - In the old layout, always remove `<pre>` margin. - In the new layout, disable `<pre>` margin if it is the last child.
1 parent 5ceb223 commit 957d05d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

runtime/doc/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ Buffer Functions *api-buffer*
20152015

20162016
For more information on buffers, see |buffers|.
20172017

2018-
Unloaded Buffers:~
2018+
Unloaded Buffers: ~
20192019

20202020
Buffers may be unloaded by the |:bunload| command or the buffer's
20212021
|'bufhidden'| option. When a buffer is unloaded its file contents are

scripts/gen_help_html.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,7 @@ local function gen_css(fname)
944944
padding-top: 10px;
945945
padding-bottom: 10px;
946946
}
947+
947948
.old-help-para {
948949
padding-top: 10px;
949950
padding-bottom: 10px;
@@ -953,6 +954,12 @@ local function gen_css(fname)
953954
font-size: 16px;
954955
font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
955956
}
957+
.old-help-para pre {
958+
/* All text in .old-help-para is formatted as "white-space:pre" so text following <pre> is
959+
already visually separated by the linebreak. */
960+
margin-bottom: 0;
961+
}
962+
956963
a.help-tag, a.help-tag:focus, a.help-tag:hover {
957964
color: inherit;
958965
text-decoration: none;
@@ -1006,6 +1013,9 @@ local function gen_css(fname)
10061013
font-size: 16px;
10071014
margin-top: 10px;
10081015
}
1016+
pre:last-child {
1017+
margin-bottom: 0;
1018+
}
10091019
pre:hover,
10101020
.help-heading:hover {
10111021
overflow: visible;

0 commit comments

Comments
 (0)