Commit graph

134 commits

Author SHA1 Message Date
James Reid-Smith
366fd9642f [ruby/rdoc] Hide hamburger on desktop
(https://github.com/ruby/rdoc/pull/1237)

* Clean up the duplicate definitions and unnecessary print styling

* Hides the navigation toggle when there's enough room to always display the navigation

* Update lib/rdoc/generator/template/darkfish/css/rdoc.css

---------

c6193bf1e2

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-12-15 13:36:38 +00:00
James Reid-Smith
f9dc41b6a9 [ruby/rdoc] Fix iPad Pro navigation not shown
(https://github.com/ruby/rdoc/pull/1236)

Found this issue when I was debugging the navigation toggle. I noticed
it first in the chrome dev tools, but it was also reproducible on
an iPad Pro.

Symptom:
- On iPad Pro, the navigation section is hidden but there's enough
  space to show it. Making the user have to click the hamburger
  button to show it but it's not necessary to hide the navigation
  section.
- On desktop, the navigation section is shown.
- On mobile, the navigation section is hidden until the hamburger
  button is clicked.

Fix:
- The javascript code was matching 1024px instead of 1023px. The media
  sections of the css was altering the layout on 1024px. So ipad got
  the full desktop layout but the navigation section was hidden.

1794e59755
2024-12-15 13:24:53 +00:00
nicholas a. evans
dd43af3be7 [ruby/rdoc] Use distinct styles for note lists and label lists
(https://github.com/ruby/rdoc/pull/1209)

* Use the original `label` description list style

As a default for all description lists, the original "label" style is
more readable.

This is slightly different from the original `label` dl though:
* slightly increased left margin for `dd` (to 1em)
* removed right margin on `dd`
* removed `dt` bottom margin and `dd` top margin, to reduce the gap
  between the term and its description (to only the standard line-height
  gap).

* Add closing tags for description list terms

Without the closing tags, the dt elements contain whitespace after the
text.  This normally isn't a big deal, but does mess some things up,
e.g: using `::after` with `content: ", "` in stylesheets.

* Restore float:left style for note lists

Unlike the original note list styles, this version sets the line-height
for all `dt` elements to be the same as the `p` elements contained
inside the `dd`, so that the second line has the same indentation as all
subsequent lines.

* Add commas between note list terms

9e69ea6d75
2024-12-08 10:43:47 +00:00
Stan Lo
ee0915feeb [ruby/rdoc] Extract excerpt from raw pages correctly
(https://github.com/ruby/rdoc/pull/1200)

Fixes https://bugs.ruby-lang.org/issues/20862

3c678249e2
2024-11-18 10:32:31 +00:00
Alexis Bernard
202a377d21 [ruby/rdoc] Split list of class and instance methods in two
(https://github.com/ruby/rdoc/pull/1206)

Looking for a method is easier because eyes don't have to skip dashes or
double colon.

6852567640
2024-11-13 16:13:21 +00:00
Alexis Bernard
7ae4b858b3 [ruby/rdoc] Display class ancestors in the sidebar #1183
50dda13426
2024-11-04 17:34:27 +00:00
Stan Lo
53df2a3c54 [ruby/rdoc] Use thicker fonts with high contrast to improve
readability
(https://github.com/ruby/rdoc/pull/1197)

7fb0e509ec
2024-10-31 10:05:19 +00:00
Nobuyoshi Nakada
10e0ebc7c2 [ruby/rdoc] Remove details markers in HTML documents
`summary {list-style: none;}` still does not work in Safari 18.

c6a0a6a0d5
2024-10-25 07:12:07 +00:00
Stan Lo
60c0c324b2 [ruby/rdoc] Red-based darkfish color scheme
(https://github.com/ruby/rdoc/pull/1191)

* Cleanup rdoc.css

* Use red as the highlight color

* Use the same red as ruby-lang.org

* Make main section links stand out more

* Remove scrollbar styling

f69dc470ac
2024-10-23 22:36:27 +00:00
Mike Dalessio
0b38e18488 [ruby/rdoc] feature: Render mixed-in methods and constants with
`--embed-mixins`
(https://github.com/ruby/rdoc/pull/842)

* Embed mixed-in methods and constants with `--embed-mixins`

When `--embed-mixins` option is set:

- methods from an `extend`ed module are documented as singleton methods
- attrs from an `extend`ed module are documented as class attributes
- methods from an `include`ed module are documented as instance methods
- attrs from an `include`ed module are documented as instance attributes
- constants from an `include`ed module are documented

Sections are created when needed, and Darkfish's template annotates
each of these mixed-in CodeObjects. We also respect the mixin methods'
visibility.

This feature is inspired by Yard's option of the same name.

* Add comment to document why we set object visibility

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Add the mixin_from attribute to CodeObject's initializer

* Add test coverage for private mixed-in attributes.

---------

481c2ce660

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-10-17 20:40:34 +00:00
Stan Lo
fc11579c49 [ruby/rdoc] Use scroll-margin-top on anchor targets
(https://github.com/ruby/rdoc/pull/1190)

This will make the anchor target easier to read.

e2fe4882f4
2024-10-17 10:11:03 +00:00
Mads Ohm Larsen
1f0b540332 [ruby/rdoc] Add scroll-margin-top on all :target elements
(https://github.com/ruby/rdoc/pull/1174)

7398e5b0ad

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-10-17 10:10:36 +00:00
Vinicius Stock
ed993b5bcc [ruby/rdoc] Generate meta tags based on page's content
(https://github.com/ruby/rdoc/pull/1091)

716bc16a7d
2024-10-15 22:59:33 +00:00
Stan Lo
a778562f33 [ruby/rdoc] Make methods and attributes linkable
(https://github.com/ruby/rdoc/pull/1189)

* Use the same color for both class/module and method highlight

* Make methods and attributes linkable

7757fd9fe4
2024-10-10 16:09:44 +00:00
Stan Lo
c5f0fe1285 [ruby/rdoc] Improve method source toggling
(https://github.com/ruby/rdoc/pull/1176)

* Move method source block to the top

Currently, if a method description is long (e.g. `Array.new`), users need
to click the method toggle button next to the method title, and then scroll
down to the source code expanded below the description.

This commit changes the behavior so that the source code is expanded
immediately below the method title.

* Update method toggle's interface

1. Display the method toggle button by default instead of displaying on hover
2. Only toggle the source code when clicking the method toggle button, not
   when clicking the entire method title section. This will allow us to display
   an anchor link next to the method title
3. Simplify the toggle source button's appearance

* Use details tag for method toggling

* Rename method-click-advice to method-source-toggle

* Improve method controls' display on mobile

By moving the method controls out of the method header, we can display
them to the right of the method name on desktop, and below the method name
on mobile.

* Add "Example" label to example code blocks

The label should help users distinguish example code blocks from other
code blocks, such as method source code.

It's only applied to Ruby code examples.

* Revert "Add "Example" label to example code blocks"

This reverts commit 69fc9ce6a3.

* Give source code blocks a different background color

* Change targeted method's highlighting color to work better with the new method source

e608a84af3
2024-10-10 09:45:41 +00:00
Sam Bostock
c818606d84 [ruby/rdoc] Use normal font-weight for links
(https://github.com/ruby/rdoc/pull/1188)

b53f0cb2ed
2024-10-07 11:25:59 +00:00
Earlopain
5ed67f4826 [ruby/rdoc] Only let browser search through source code until it's
expanded
(https://github.com/ruby/rdoc/pull/1181)

Something that's been bothering me is that while the source code is
not visible by default, the browser still jump to it when searching.
Adding the `visible` property prevents this.

Test it out yourself:
* `bundle exec rdoc`
* open `_site/index.html`
* Search for `NameError`

Before, you will get a match from `load_yaml` source code, after
you only get the match when that methods source code is expanded.

003126cc23
2024-09-30 11:32:45 +00:00
Mads Ohm Larsen
ec5d5422ca [ruby/rdoc] Use pointer cursor for navigation toggle
(https://github.com/ruby/rdoc/pull/1175)

964a1982c8
2024-09-08 12:17:36 +00:00
Mads Ohm Larsen
6dc9384694 [ruby/rdoc] Add more space after magnifying glass
(https://github.com/ruby/rdoc/pull/1173)

6a9cad4c54
2024-09-06 21:26:17 +00:00
Stan Lo
ec61dbd98e [ruby/rdoc] Make darkfish more responsive and readable on mobile
devices
(https://github.com/ruby/rdoc/pull/1162)

- Make the sidebar toggle fixed on all devices
- Prevent default zooming on mobile devices
- Improve sidebar opening on mobile devices

95b6cfb64f
2024-08-26 22:02:33 +00:00
Ufuk Kayserilioglu
519152db6d [ruby/rdoc] Make the summary triangle appear in the correct place
when the summary text overflows to next line.
(https://github.com/ruby/rdoc/pull/1160)

f2eb62f6f8
2024-08-24 18:15:21 +00:00
Stan Lo
6717b69067 [ruby/rdoc] Modernize RDoc Darkfish template CSS
(https://github.com/ruby/rdoc/pull/1157)

- Update color scheme with muted green tones and improved contrast
- Enhance readability by adjusting font sizes and weights
- Improve code block styling with a light gray background
- Refactor layout for better responsiveness and sidebar presentation
- Standardize link styles across the document
- Implement CSS variables for easier theme customization
- Adjust heading styles for better visual hierarchy
- Enhance table and list styling for improved readability
- Optimize search field and navigation toggle appearance
- Improve method detail and documentation section styling
- Reorganize css and overhaul the sidebar design
- Improve code block's syntax highlighting

6cde9edadb
2024-08-24 11:07:28 +00:00
Stan Lo
923e36ab21 [ruby/rdoc] Fix sidebar scroll again and add missing footer back
(https://github.com/ruby/rdoc/pull/1154)

* Add missing footers

In #1152 the footer partial was only added to the index.rhtml file.
This commit adds the footer partial to the other template files.

* Remove unnecessary middle divs in nav

* Simplify sidebar's overflow settings

Because sidebar needs to be scrollable, its overflow should default to auto.
Currently it's set to hidden and force individual elements to set overflow auto,
which overcomplicates things.

b8c2bcd8db
2024-08-15 13:33:00 +00:00
Stan Lo
908305a297 Sync rdoc 2024-08-13 09:10:15 -04:00
Stan Lo
64a7b87e1d
Sync rdoc to fix master doc's display issue (#11345)
Sync rdoc

This syncs changes made in https://github.com/ruby/rdoc/pull/1148, which
will fix https://docs.ruby-lang.org/en/master/'s display on certain screens.
2024-08-08 13:02:46 -07:00
tompng
8d39939107 [ruby/rdoc] Use ascii chatacter in HTML file
40a6690010
2024-08-08 08:54:52 +09:00
Stan Lo
cbc40bb130 Sync rdoc 2024-08-05 08:27:45 +08:00
Stan Lo
239d54dfbc [ruby/rdoc] Improve rubocop setup
(https://github.com/ruby/rdoc/pull/1139)

* Rename rake rubocop to rake format_generated_files

* Add rubocop rules to ensure spaces are applied consistently

* Improve rubocop related CI workflows

27932d001c
2024-07-17 20:43:08 +00:00
Yudai Takada
15ceb95d78 [ruby/rdoc] Fix some typos (https://github.com/ruby/rdoc/pull/1129)
* constist ==> consist

* Tidyness ==> Tidiness

* Currentry ==> Currently

* valus ==> values

8412705721
2024-07-01 11:08:37 +09:00
Nobuyoshi Nakada
20f4f00764 [ruby/rdoc] [DOC] nodoc for probably internal methods
f7dd147a8c
2023-12-16 00:26:39 +09:00
Nobuyoshi Nakada
7973eb7c3f [ruby/rdoc] [DOC] Slightly decorate em and strong
2161157205
2023-11-27 16:07:03 +00:00
Nobuyoshi Nakada
dab6d55db1 [ruby/rdoc] Remove code for versions older than Ruby 2.6
0d10f460eb
2023-09-05 01:14:52 +00:00
Jeremy Evans
3f6c92e9d5 [ruby/rdoc] Omit descriptions and parameter lists for methods defined in C not mentioned in call-seq
This allows RDoc to better generate documentation for methods
following the Ruby core documentation guide (which omits aliases
in call-seq in most cases).  This makes documentation for methods
defined in C more similar to methods defined in Ruby.  For methods
defined in Ruby, the method description of the aliased method is
already not used (you have to explicitly document the alias to
use it).

Internally, this adds AnyMethod#has_call_seq? and #skip_description?,
and updates Darkfish to:

* only show the method name if there is a call-seq for the method,
  but the call-seq omits the method
* to omit the method description if the method is an alias or has
  aliases and has a call-seq that does not include the method

See discussion in https://github.com/ruby/ruby/pull/7316 for
details.

e3688de49b
2023-09-05 00:45:42 +00:00
Masafumi Koba
62b4983416 [ruby/rdoc] [DOC] Improve CSS for "toggle source" hovering over one more method signatures
This commit improves the behavior of showing the "toggle source" element on mouseover.

For example, when a method has one more signatures by using `:call-seq:`,

```ruby
# :call-seq:
#   foo {|element| ... } -> self
#   foo -> new_enumeration
def foo
end
```

The current CSS doesn't show "toggle source" even when hovering the second signature `foo -> new_enumeration`.
But this change will show "toggle source" always when hovering over any signature.

For details about the `.method-header` element, see `lib/rdoc/generator/template/darkfish/class.rhtml`:
0e060c69f5/lib/rdoc/generator/template/darkfish/class.rhtml (L101-L124)

For example, see https://docs.ruby-lang.org/en/3.2/Array.html#method-i-delete
2023-07-05 04:09:08 +00:00
gemmaro
62754503d8 [ruby/rdoc] [DOC] Fix to use KeyboardEvent.key over keyCode
663edc807c
2023-07-05 03:39:18 +00:00
gemmaro
77fa4787bd [ruby/rdoc] Add keydown event listener to focus on search field
db62e47df2
2023-07-05 03:37:28 +00:00
Petrik
0c55ef1150 [ruby/rdoc] Use flat_map for better performance
76192a280d
2023-06-14 23:47:25 +00:00
Vinicius Stock
a4d92475f6 [ruby/rdoc] Auto-correct trailing new lines
4b68c0728a
2023-06-03 01:42:29 +00:00
Masafumi Koba
94e5ecbbdd [ruby/rdoc] Improve <summary> CSS on sidebar
- Use a smaller font size for the toggle symbol. (Currently, it seems a little too large)
- Use the child combinator (`>`) to unify selectors.
- Use `margin-left` instead of whitespace within the `content` property.
- Use `::` instead of outdated `:` for the pseudo-element symbol.
  (See https://developer.mozilla.org/en-US/docs/Web/CSS/::before)

61ce0a7d75
2023-05-26 16:26:46 +00:00
Masafumi Koba
54b7ce0bff [ruby/rdoc] Improve layout CSS
- Use the `grid` property for the page layout.
  - https://caniuse.com/css-grid
- Adjust the `<main>` margin.
- Make the sidebar responsive and resizable.
  - https://caniuse.com/css-math-functions
  - https://caniuse.com/css-resize

Note all modern browsers support the new CSS properties and functions used by this change.

2db5097c41
2023-05-26 16:24:57 +00:00
Nobuyoshi Nakada
e47aa27dc7 [ruby/rdoc] Section may not have label
945f0cb3e9
2023-05-02 05:42:37 +00:00
Nobuyoshi Nakada
3833d0fee6 [ruby/rdoc] Fix references to nested label in table_of_contents
Fixes https://github.com/ruby/rdoc/pull/1000

291e2b7e8b
2023-05-02 04:19:46 +00:00
nick evans
29862ce273 [ruby/rdoc] Darkfish: group method call-seq in div.method-header
This way, custom CSS styles can be easily applied to the entire method
header at once.  Otherwise, it can be tricky to make a border that goes
around the entire set of method call-seq, but not the method
description.

5db4bce01e
2022-11-27 17:24:17 +00:00
nick evans
ae3817bc61 [ruby/rdoc] Darkfish: Nest sidebar ToC as a tree of headings
This uses `<details><summary>heading</summary><ul>nested</ul></detail>`,
similar to how the classes and pages lists are now nested.

e57beff287
2022-11-27 17:18:16 +00:00
Nobuyoshi Nakada
511864d1a7 [ruby/rdoc] Refine regexp usages and reduce substring allocations
a976fb9d39
2022-11-27 16:35:08 +00:00
Nobuyoshi Nakada
39909d8c18 [ruby/rdoc] Escape search results
https://hackerone.com/reports/1321358

2ebf8fd510
2022-10-07 12:12:09 +09:00
Nobuyoshi Nakada
a3cb09c7d1 [ruby/rdoc] Escape file names
https://hackerone.com/reports/1321358

8c07cc4657
2022-10-07 12:12:08 +09:00
Nobuyoshi Nakada
8d0b2162a0 [ruby/rdoc] Escape main title
https://hackerone.com/reports/1187156

5dedb5741d
2022-10-07 12:09:23 +09:00
Nobuyoshi Nakada
92ef73a918 [ruby/rdoc] Expand the enclosing tree of the current file
f9f90ef2ff
2022-03-22 01:32:13 +09:00
Nobuyoshi Nakada
dafe5c1323 [ruby/rdoc] Fold files in the page directory
b7b4cdab6c
2022-03-22 01:32:12 +09:00