From 5abb2e6bb1fd2d0472c7ca4c14bb020dbd75b1d9 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sat, 22 Nov 2025 17:13:24 +0000 Subject: [PATCH 1/3] Improve light mode link colors - Normal links should be the same color as the text, not red. - Method name links should be the same color as the text, not red. --- lib/rdoc/generator/template/aliki/css/rdoc.css | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/rdoc/generator/template/aliki/css/rdoc.css b/lib/rdoc/generator/template/aliki/css/rdoc.css index 7bcc748d99..1efe3d7089 100644 --- a/lib/rdoc/generator/template/aliki/css/rdoc.css +++ b/lib/rdoc/generator/template/aliki/css/rdoc.css @@ -61,8 +61,8 @@ --color-border-default: var(--color-neutral-300); --color-border-subtle: var(--color-neutral-200); --color-border-emphasis: var(--color-neutral-400); - --color-link-default: var(--color-primary-600); - --color-link-hover: var(--color-primary-700); + --color-link-default: var(--color-text-primary); + --color-link-hover: var(--color-primary-600); --color-accent-primary: var(--color-primary-600); --color-accent-hover: var(--color-primary-700); --color-accent-subtle: var(--color-primary-50); @@ -635,7 +635,6 @@ nav ul ul ul ul { } nav a { - color: var(--color-text-primary); text-decoration: none; } @@ -1006,12 +1005,10 @@ main .method-heading { } main .method-heading .method-name { - color: var(--color-text-primary); font-weight: var(--font-weight-semibold); } main .method-heading .method-args { - color: var(--color-text-secondary); font-weight: var(--font-weight-normal); } From ebcae0fdefd2d5804399987c2efc8c6409fe2261 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sat, 22 Nov 2025 10:49:32 +0000 Subject: [PATCH 2/3] Remove outdated go-to-top link feature --- lib/rdoc/generator/template/aliki/class.rhtml | 5 +-- lib/rdoc/generator/template/aliki/index.rhtml | 2 +- lib/rdoc/generator/template/aliki/js/aliki.js | 2 +- lib/rdoc/generator/template/aliki/page.rhtml | 2 +- lib/rdoc/markup/to_html.rb | 3 +- test/rdoc/generator/markup_test.rb | 3 +- test/rdoc/markup/to_html_test.rb | 32 +++++++------------ 7 files changed, 17 insertions(+), 32 deletions(-) diff --git a/lib/rdoc/generator/template/aliki/class.rhtml b/lib/rdoc/generator/template/aliki/class.rhtml index 593b96db22..0d6fbe25ba 100644 --- a/lib/rdoc/generator/template/aliki/class.rhtml +++ b/lib/rdoc/generator/template/aliki/class.rhtml @@ -1,4 +1,4 @@ - + <%= render '_header.rhtml' %> <%= render '_sidebar_toggle.rhtml' %> @@ -43,9 +43,6 @@

<%= section.title %>

- - ↑ top - <%- end %> diff --git a/lib/rdoc/generator/template/aliki/index.rhtml b/lib/rdoc/generator/template/aliki/index.rhtml index 1b6051d4d6..b86154a33e 100644 --- a/lib/rdoc/generator/template/aliki/index.rhtml +++ b/lib/rdoc/generator/template/aliki/index.rhtml @@ -1,4 +1,4 @@ - + <%= render '_header.rhtml' %> <%= render '_sidebar_toggle.rhtml' %> diff --git a/lib/rdoc/generator/template/aliki/js/aliki.js b/lib/rdoc/generator/template/aliki/js/aliki.js index af851900c4..f0c10e7c42 100644 --- a/lib/rdoc/generator/template/aliki/js/aliki.js +++ b/lib/rdoc/generator/template/aliki/js/aliki.js @@ -191,7 +191,7 @@ function generateToc() { const link = document.createElement('a'); link.href = `#${heading.id}`; link.className = 'toc-link'; - link.textContent = heading.textContent.replace(/¶.*$/, '').trim(); // Remove pilcrow and "top" links + link.textContent = heading.textContent.replace(/¶.*$/, '').trim(); // Remove pilcrow link link.setAttribute('data-target', heading.id); li.appendChild(link); diff --git a/lib/rdoc/generator/template/aliki/page.rhtml b/lib/rdoc/generator/template/aliki/page.rhtml index 8581cdc0a9..f4a752fe6e 100644 --- a/lib/rdoc/generator/template/aliki/page.rhtml +++ b/lib/rdoc/generator/template/aliki/page.rhtml @@ -1,4 +1,4 @@ - + <%= render '_header.rhtml' %> <%= render '_sidebar_toggle.rhtml' %> diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index a949c53e41..409c46d3a1 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -314,8 +314,7 @@ def accept_heading(heading) end @res << to_html(heading.text) unless @options.pipe then - @res << "" - @res << " " + @res << "" end @res << "\n" end diff --git a/test/rdoc/generator/markup_test.rb b/test/rdoc/generator/markup_test.rb index 682214267b..f86f5be446 100644 --- a/test/rdoc/generator/markup_test.rb +++ b/test/rdoc/generator/markup_test.rb @@ -38,8 +38,7 @@ def test_cvs_url def test_description @comment = '= Hello' - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", description end diff --git a/test/rdoc/markup/to_html_test.rb b/test/rdoc/markup/to_html_test.rb index caa11c3e7f..e78c082806 100644 --- a/test/rdoc/markup/to_html_test.rb +++ b/test/rdoc/markup/to_html_test.rb @@ -24,44 +24,38 @@ def accept_document end def accept_heading - links = ' ' + - '' + links = '' expected = "\n
Hello#{links}
\n" assert_equal expected, @to.res.join end def accept_heading_1 - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end def accept_heading_2 - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end def accept_heading_3 - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end def accept_heading_4 - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end def accept_heading_b - links = ' ' + - '' + links = '' inner = "Hello" assert_equal "\n

#{inner}#{links}

\n", @@ -69,8 +63,7 @@ def accept_heading_b end def accept_heading_suppressed_crossref - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end @@ -348,8 +341,7 @@ def test_accept_heading_7 @to.accept_heading @RM::Heading.new(7, 'Hello') - links = ' ' + - '' + links = '' assert_equal "\n
Hello#{links}
\n", @to.res.join end @@ -360,8 +352,7 @@ def test_accept_heading_aref_class @to.accept_heading head(1, 'Hello') - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join @@ -373,8 +364,7 @@ def test_accept_heading_aref_method @to.accept_heading @RM::Heading.new(1, 'Hello') - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join @@ -437,7 +427,7 @@ def test_accept_heading_output_decoration @to.accept_heading @RM::Heading.new(1, 'Hello') - assert_equal "\n

Hello

\n", @to.res.join + assert_equal "\n

Hello

\n", @to.res.join end def test_accept_heading_output_decoration_with_pipe From f48d9e312a59a76e4ec6504259632881fe7c8efa Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sat, 22 Nov 2025 16:52:47 +0000 Subject: [PATCH 3/3] Make headers/method names directly linkable instead of using pilcrow items --- lib/rdoc/generator/template/aliki/class.rhtml | 8 +-- .../generator/template/aliki/css/rdoc.css | 61 ++++++------------- lib/rdoc/generator/template/aliki/js/aliki.js | 2 +- lib/rdoc/markup/to_html.rb | 9 ++- test/rdoc/generator/darkfish_test.rb | 4 +- test/rdoc/generator/markup_test.rb | 4 +- test/rdoc/markup/to_html_test.rb | 42 ++++--------- 7 files changed, 45 insertions(+), 85 deletions(-) diff --git a/lib/rdoc/generator/template/aliki/class.rhtml b/lib/rdoc/generator/template/aliki/class.rhtml index 0d6fbe25ba..2f721a5610 100644 --- a/lib/rdoc/generator/template/aliki/class.rhtml +++ b/lib/rdoc/generator/template/aliki/class.rhtml @@ -41,7 +41,7 @@ <%- if section.title then %>

- <%= section.title %> + <%= section.title %>

<%- end %> @@ -55,7 +55,7 @@ <%- unless constants.empty? then %>
-

Constants

+

Constants

<%- constants.each do |const| %> @@ -80,7 +80,7 @@ <%- unless attributes.empty? then %>
-

Attributes

+

Attributes

<%- attributes.each do |attrib| %> @@ -115,7 +115,7 @@ next if methods.empty? %>