From 3e59512ac0dc7143bfc7895078fc2179d4c56147 Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Sun, 27 Aug 2023 13:05:56 -0500 Subject: [PATCH] Increase top margin for long list items List items inside `#content` use `var(--space-sm)` as their top margin because `var(--space)` looks too disjointed for single-paragraph items, especially single-line items. However, when a list item contains an element that itself has a `var(--space)` top margin, the list item's top margin looks mismatched. This commit adds a style tweak such that all list items in a list with any multi-paragraph items will use `var(--space)` for their top margin. (More specifically, when any item contains a paragraph plus another block level element, such as another paragraph or a code block.) Unfortunately, this enhancement does not currently work in Firefox because it relies on the `:has()` selector. However, it is only a minor enhancement, and Firefox plans to support `:has()` in the near future. --- lib/rdoc/generator/template/rails/resources/css/main.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/rdoc/generator/template/rails/resources/css/main.css b/lib/rdoc/generator/template/rails/resources/css/main.css index 693155af..ce42fe8a 100644 --- a/lib/rdoc/generator/template/rails/resources/css/main.css +++ b/lib/rdoc/generator/template/rails/resources/css/main.css @@ -382,6 +382,11 @@ html { margin-top: var(--space-sm); } +/* Increase top margin for list items when any item has more than one paragraph */ +:where(#content :is(ol, ul):has(> li > p:not(:only-child))) * + li { + margin-top: var(--space); +} + :where(#content) code { font-style: normal; }