Skip to content

Fix missing indentation on targeted .method-detail elements#1435

Open
dkibui wants to merge 1 commit into
ruby:masterfrom
dkibui:fix/method-detail-target-spacing
Open

Fix missing indentation on targeted .method-detail elements#1435
dkibui wants to merge 1 commit into
ruby:masterfrom
dkibui:fix/method-detail-target-spacing

Conversation

@dkibui

@dkibui dkibui commented Oct 19, 2025

Copy link
Copy Markdown

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 dkibui had a problem deploying to fork-preview-protection October 19, 2025 21:43 — with GitHub Actions Failure
@kou

kou commented Oct 29, 2025

Copy link
Copy Markdown
Member

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

@tompng

tompng commented Oct 30, 2025

Copy link
Copy Markdown
Member

There is a related pull request #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)

@kou

kou commented Oct 30, 2025

Copy link
Copy Markdown
Member

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

@st0012

st0012 commented Nov 18, 2025

Copy link
Copy Markdown
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants