mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
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.
This commit is contained in:

committed by
Christian Clason

parent
618e34ca09
commit
174da7fe68
@@ -1093,14 +1093,19 @@ local function gen_css(fname)
|
|||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
/* Tabs are used for alignment in old docs, so we must match Vim's 8-char expectation. */
|
/* Tabs are used for alignment in old docs, so we must match Vim's 8-char expectation. */
|
||||||
tab-size: 8;
|
tab-size: 8;
|
||||||
white-space: normal;
|
white-space: pre-wrap;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
|
font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
|
||||||
word-wrap: break-word;
|
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. */
|
/* Text following <pre> is already visually separated by the linebreak. */
|
||||||
margin-bottom: 0;
|
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> */
|
/* TODO: should this rule be deleted? help tags are rendered as <code> or <span>, not <a> */
|
||||||
|
Reference in New Issue
Block a user