rdoc icon indicating copy to clipboard operation
rdoc copied to clipboard

Fix missing indentation on targeted .method-detail elements

Open dkibui opened this issue 4 months ago • 4 comments

This patch improves the spacing of highlighted method details in generated RDoc pages.

When a method anchor (for example, #method-i-force) is targeted, a left border is applied to the .method-detail element. Previously the border caused the inner content of the selected element to touch the left border, reducing readability.

This change adds a small left padding to the targeted element to maintain consistent spacing between the border and its contents.

Screenshot 2025-10-19 at 16 05 07 Screenshot 2025-10-19 at 16 04 43

dkibui avatar Oct 19 '25 13:10 dkibui

If we use this approach, method entries aren't aligned:

image

How about this?

diff --git a/lib/rdoc/generator/template/darkfish/css/rdoc.css b/lib/rdoc/generator/template/darkfish/css/rdoc.css
index c84a604c..456d2a03 100644
--- a/lib/rdoc/generator/template/darkfish/css/rdoc.css
+++ b/lib/rdoc/generator/template/darkfish/css/rdoc.css
@@ -580,8 +580,9 @@ main .method-detail {
 }
 
 main .method-detail:target {
-  margin-left: -10px;
-  border-left: 10px solid var(--border-color);
+  margin-left: -15px;
+  border-left: 5px solid var(--border-color);
+  padding-left: 10px;
 }
 
 main .method-header {
image

kou avatar Oct 29 '25 01:10 kou

There is a related pull request https://github.com/ruby/rdoc/pull/1363 that restrict the highlight only to method signature part. It solve method entries not-aligned problem in another way.

I think it's both fine adding indent or move highlight left, it's a design matter. (I think RDoc needs a designer)

tompng avatar Oct 30 '25 06:10 tompng

Ah, sorry. I saw the pull request but I couldn't remember it.

kou avatar Oct 30 '25 06:10 kou

Thanks for the PR! Unfortunately I've addressed the issue in the upcoming new theme so this won't be necessary anymore 😅

Screenshot 2025-11-18 at 22 34 24

st0012 avatar Nov 18 '25 22:11 st0012