aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_help_html.lua
diff options
context:
space:
mode:
authorJongwook Choi <wookayin@gmail.com>2024-05-14 23:34:14 -0400
committerChristian Clason <c.clason@uni-graz.at>2024-05-16 09:01:05 +0200
commit174da7fe687bd3bf2f6874620e708db24160c4d7 (patch)
tree96d006a05e03d8cc204893400aec58dfbe02da66 /scripts/gen_help_html.lua
parent618e34ca095739935ac436fec58bb2a223ea3dc1 (diff)
downloadrneovim-174da7fe687bd3bf2f6874620e708db24160c4d7.tar.gz
rneovim-174da7fe687bd3bf2f6874620e708db24160c4d7.tar.bz2
rneovim-174da7fe687bd3bf2f6874620e708db24160c4d7.zip
docs(gen_help_html.lua): fix broken pre text, and handle linewrap
Problem: - Since #28678, pre-formatted text in the online documentation do not render whitespaces correctly: should be pre-like text, but shown like normal paragraph (see #28754). - Code blocks with long lines should not be wrapped (e.g. see |dev-vimpatch-list-management|). Solution: - Use `white-space: pre-wrap`. Compared to `white-space: pre`, this option will make long lines including a very long URL wrapped. This properly fixes #28754 and #28678. - Use horizontal scrollbar for the code blocks that are horizontally too long, instead of wrapping text. This will make the code easy to read while the pre-text block not interfering with the navigation bar.
Diffstat (limited to 'scripts/gen_help_html.lua')
-rw-r--r--scripts/gen_help_html.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua
index d65f3aace2..7432f5ecc4 100644
--- a/scripts/gen_help_html.lua
+++ b/scripts/gen_help_html.lua
@@ -1093,14 +1093,19 @@ local function gen_css(fname)
padding-bottom: 10px;
/* Tabs are used for alignment in old docs, so we must match Vim's 8-char expectation. */
tab-size: 8;
- white-space: normal;
+ white-space: pre-wrap;
font-size: 16px;
font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
word-wrap: break-word;
}
- .old-help-para pre {
+ .old-help-para pre, .old-help-para pre:hover {
/* Text following <pre> is already visually separated by the linebreak. */
margin-bottom: 0;
+ /* Long lines that exceed the textwidth should not be wrapped (no "pre-wrap").
+ Since text may overflow horizontally, we make the contents to be scrollable
+ (only if necessary) to prevent overlapping with the navigation bar at the right. */
+ white-space: pre;
+ overflow-x: auto;
}
/* TODO: should this rule be deleted? help tags are rendered as <code> or <span>, not <a> */