Commit graph

90 commits

Author SHA1 Message Date
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
Nobuyoshi Nakada
7973eb7c3f [ruby/rdoc] [DOC] Slightly decorate em and strong
2161157205
2023-11-27 16:07:03 +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
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
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
Nobuyoshi Nakada
73541cdc2f
[ruby/rdoc] Allow method source code to scroll [ci skip]
1bb0496c53
2022-03-20 15:42:56 +09:00
Nobuyoshi Nakada
20ad09e560 [ruby/rdoc] Use the custom style details summary only in nav-section
7736d3a89c
2022-03-20 15:38:28 +09:00
Nobuyoshi Nakada
0bf194fb33 [ruby/rdoc] Start with open when only one visible class/module
6bb93001db
2022-03-14 14:48:13 +09:00
Nobuyoshi Nakada
976431d9ed [ruby/rdoc] Fold class and module index
4c7c46fcc4
2022-03-14 14:48:12 +09:00
Masafumi Koba
2e4516be26 [ruby/rdoc] Scrollable sidebar
This change makes the sidebar scrollable via `position: sticky` and `overflow: auto`;
See also <https://caniuse.com/?search=sticky>

4d52e24840
2022-03-11 17:38:13 +09:00
aycabta
4b024234b2 [ruby/rdoc] Update SourceCodePro font files
d3201d0d47
2021-10-11 21:15:07 +09:00
Nobuyoshi Nakada
76c7388c1f [ruby/rdoc] Add tests for --template-stylesheets option
Also flattens `@options.template_stylesheets` when parsing the
command lines.

Fixes #205
Fixes #828 too

857002a763
2021-09-03 19:13:15 +09:00
Nobuyoshi Nakada
10b082064e [ruby/rdoc] Add table style
2219c5ae80
2021-03-16 15:47:27 +09:00
Pankaj Doharey
05898c5b90 [ruby/rdoc] Update Rdoc.css sidebar panel.
Updates css so the sidebar look like a panel instead of looking like chopped edges.

b0098c6d72
2021-03-16 15:47:27 +09:00
Benoit Tigeot
7693aa7056 [ruby/rdoc] Remove empty lines from html file by using ERB trim_mode flag
9e27299a46
2020-07-22 02:34:58 +09:00
Nobuyoshi Nakada
e6d1363ae6 [ruby/rdoc] Fixed inverted CSS for note-list and label-list
a13d6439da
2020-05-24 23:47:24 +09:00