rdoc 7.2.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +4 -7
  3. data/LICENSE.rdoc +4 -0
  4. data/README.md +43 -2
  5. data/RI.md +75 -75
  6. data/doc/markup_reference/markdown.md +104 -3
  7. data/exe/rdoc +2 -2
  8. data/lib/rdoc/code_object/alias.rb +70 -74
  9. data/lib/rdoc/code_object/any_method.rb +305 -298
  10. data/lib/rdoc/code_object/attr.rb +150 -143
  11. data/lib/rdoc/code_object/class_module.rb +801 -765
  12. data/lib/rdoc/code_object/constant.rb +178 -150
  13. data/lib/rdoc/code_object/context/section.rb +133 -160
  14. data/lib/rdoc/code_object/context.rb +925 -952
  15. data/lib/rdoc/code_object/extend.rb +7 -5
  16. data/lib/rdoc/code_object/include.rb +7 -5
  17. data/lib/rdoc/code_object/method_attr.rb +325 -324
  18. data/lib/rdoc/code_object/mixin.rb +97 -95
  19. data/lib/rdoc/code_object/normal_class.rb +77 -78
  20. data/lib/rdoc/code_object/normal_module.rb +61 -59
  21. data/lib/rdoc/code_object/require.rb +23 -39
  22. data/lib/rdoc/code_object/single_class.rb +21 -19
  23. data/lib/rdoc/code_object/top_level.rb +212 -213
  24. data/lib/rdoc/code_object.rb +305 -305
  25. data/lib/rdoc/comment.rb +274 -337
  26. data/lib/rdoc/cross_reference.rb +194 -212
  27. data/lib/rdoc/encoding.rb +105 -103
  28. data/lib/rdoc/erb_partial.rb +13 -11
  29. data/lib/rdoc/erbio.rb +29 -27
  30. data/lib/rdoc/generator/aliki.rb +165 -140
  31. data/lib/rdoc/generator/darkfish.rb +647 -631
  32. data/lib/rdoc/generator/json_index.rb +233 -229
  33. data/lib/rdoc/generator/markup.rb +165 -122
  34. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  35. data/lib/rdoc/generator/pot/po.rb +52 -51
  36. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  37. data/lib/rdoc/generator/pot.rb +85 -81
  38. data/lib/rdoc/generator/ri.rb +23 -19
  39. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  40. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  41. data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
  42. data/lib/rdoc/generator/template/aliki/_head.rhtml +11 -11
  43. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  44. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  45. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  46. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  47. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +2 -2
  48. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
  49. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  50. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  51. data/lib/rdoc/generator/template/aliki/class.rhtml +56 -46
  52. data/lib/rdoc/generator/template/aliki/css/rdoc.css +538 -283
  53. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  54. data/lib/rdoc/generator/template/aliki/js/aliki.js +80 -102
  55. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  57. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  58. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  59. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  60. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  61. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  62. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
  63. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  64. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  65. data/lib/rdoc/generator/template/darkfish/class.rhtml +18 -21
  66. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +0 -1
  67. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  68. data/lib/rdoc/generator.rb +48 -46
  69. data/lib/rdoc/i18n/locale.rb +99 -95
  70. data/lib/rdoc/i18n/text.rb +109 -105
  71. data/lib/rdoc/i18n.rb +7 -5
  72. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  73. data/lib/rdoc/markdown.kpeg +30 -21
  74. data/lib/rdoc/markdown.rb +329 -151
  75. data/lib/rdoc/markup/block_quote.rb +12 -8
  76. data/lib/rdoc/markup/document.rb +127 -123
  77. data/lib/rdoc/markup/formatter.rb +215 -221
  78. data/lib/rdoc/markup/heading.rb +1 -4
  79. data/lib/rdoc/markup/include.rb +33 -29
  80. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  81. data/lib/rdoc/markup/inline_parser.rb +281 -277
  82. data/lib/rdoc/markup/list.rb +80 -88
  83. data/lib/rdoc/markup/list_item.rb +73 -85
  84. data/lib/rdoc/markup/paragraph.rb +23 -19
  85. data/lib/rdoc/markup/parser.rb +501 -497
  86. data/lib/rdoc/markup/pre_process.rb +284 -305
  87. data/lib/rdoc/markup/raw.rb +2 -2
  88. data/lib/rdoc/markup/rule.rb +16 -12
  89. data/lib/rdoc/markup/to_ansi.rb +143 -139
  90. data/lib/rdoc/markup/to_bs.rb +72 -68
  91. data/lib/rdoc/markup/to_html.rb +600 -493
  92. data/lib/rdoc/markup/to_html_crossref.rb +221 -191
  93. data/lib/rdoc/markup/to_html_snippet.rb +232 -227
  94. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  95. data/lib/rdoc/markup/to_label.rb +63 -59
  96. data/lib/rdoc/markup/to_markdown.rb +212 -208
  97. data/lib/rdoc/markup/to_rdoc.rb +336 -332
  98. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  99. data/lib/rdoc/markup/to_test.rb +60 -56
  100. data/lib/rdoc/markup/to_tt_only.rb +83 -86
  101. data/lib/rdoc/markup/verbatim.rb +62 -58
  102. data/lib/rdoc/markup.rb +198 -196
  103. data/lib/rdoc/options.rb +1063 -1076
  104. data/lib/rdoc/parser/c.rb +1039 -1036
  105. data/lib/rdoc/parser/changelog.rb +319 -315
  106. data/lib/rdoc/parser/markdown.rb +17 -13
  107. data/lib/rdoc/parser/rbs.rb +279 -0
  108. data/lib/rdoc/parser/rd.rb +17 -13
  109. data/lib/rdoc/parser/ruby.rb +1231 -2222
  110. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  111. data/lib/rdoc/parser/simple.rb +31 -27
  112. data/lib/rdoc/parser/text.rb +12 -8
  113. data/lib/rdoc/parser.rb +230 -221
  114. data/lib/rdoc/rbs_helper.rb +186 -0
  115. data/lib/rdoc/rd/inline.rb +57 -53
  116. data/lib/rdoc/rd.rb +90 -88
  117. data/lib/rdoc/rdoc.rb +547 -366
  118. data/lib/rdoc/ri/driver.rb +1141 -1130
  119. data/lib/rdoc/ri/formatter.rb +7 -3
  120. data/lib/rdoc/ri/paths.rb +140 -136
  121. data/lib/rdoc/ri/servlet.rb +456 -0
  122. data/lib/rdoc/ri/store.rb +4 -2
  123. data/lib/rdoc/ri/task.rb +55 -51
  124. data/lib/rdoc/ri.rb +14 -11
  125. data/lib/rdoc/rubygems_hook.rb +194 -192
  126. data/lib/rdoc/server.rb +462 -0
  127. data/lib/rdoc/stats/normal.rb +46 -42
  128. data/lib/rdoc/stats/quiet.rb +39 -35
  129. data/lib/rdoc/stats/verbose.rb +35 -31
  130. data/lib/rdoc/stats.rb +363 -338
  131. data/lib/rdoc/store.rb +919 -725
  132. data/lib/rdoc/task.rb +260 -255
  133. data/lib/rdoc/text.rb +130 -245
  134. data/lib/rdoc/token_stream.rb +101 -115
  135. data/lib/rdoc/tom_doc.rb +203 -201
  136. data/lib/rdoc/version.rb +1 -1
  137. data/lib/rdoc.rb +35 -7
  138. data/lib/rubygems_plugin.rb +2 -11
  139. data/rdoc-logo.svg +43 -0
  140. data/rdoc.gemspec +6 -4
  141. metadata +36 -20
  142. data/lib/rdoc/code_object/anon_class.rb +0 -10
  143. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  144. data/lib/rdoc/code_object/meta_method.rb +0 -6
  145. data/lib/rdoc/markdown/literals.kpeg +0 -21
  146. data/lib/rdoc/markdown/literals.rb +0 -454
  147. data/lib/rdoc/parser/prism_ruby.rb +0 -1112
  148. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  149. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  150. data/lib/rdoc/servlet.rb +0 -452
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1acd5d230eb6cc33e92e6ead29ef4edfd11d238750073c151197675b9d2ecef7
4
- data.tar.gz: 765310288cb7611ae3990d238a894e9bd1e2d3431c2389c412f0a9407699a4ad
3
+ metadata.gz: 8bd46d161ae9d2249a6e2ea1afdb46e08cdc737260427c472fe39981d6ea6d00
4
+ data.tar.gz: 81e455d982e6e564e84058ba420aa59ee9d7792f93de961051d705bada6cd4f0
5
5
  SHA512:
6
- metadata.gz: b3f79da244c49a5f13485ca9cec594aebd9cbcf9e2a8be2543aa186947ea645aac4ec783f4d3a19b9197ffa7b9e3df53e89dc774adf7ef4c394597c186039a76
7
- data.tar.gz: c13a7678b03b25bbe56c854f7314fe50b8df2784d85d04b765294f5fd32baefb92a702e66233007689f1c4a65d7141c6e428af89e5953ce5e19976418e0fd76b
6
+ metadata.gz: 3a9fb465374b2b6fa07e949c50284394377b48657de07da3a78604f2b646558a4ebe4dc06aaea4e773f185370256971c5563159ab1c0dab6bd5b65cc3e2a94f3
7
+ data.tar.gz: 99b8a3b9ac9b568a4ab8a23fa3cd5dd6b1385f562d800a54094d533bf153b3696337d217df999f94c88236049a357f3fa655b592cba7106f50829e9d72f4d02f
data/CONTRIBUTING.md CHANGED
@@ -115,7 +115,6 @@ bundle exec rake verify_generated
115
115
  - `lib/rdoc/rd/block_parser.ry` → generates `block_parser.rb` via racc
116
116
  - `lib/rdoc/rd/inline_parser.ry` → generates `inline_parser.rb` via racc
117
117
  - `lib/rdoc/markdown.kpeg` → generates `markdown.rb` via kpeg
118
- - `lib/rdoc/markdown/literals.kpeg` → generates `literals.rb` via kpeg
119
118
 
120
119
  **Important:**
121
120
 
@@ -146,7 +145,7 @@ bundle exec rake coverage
146
145
  RDoc ships with two HTML themes:
147
146
 
148
147
  - **Aliki** (default) - Modern theme with improved styling and navigation
149
- - **Darkfish** (deprecated) - Classic theme, will be removed in v8.0
148
+ - **Darkfish** (deprecated) - Classic theme, will be removed in v9.0
150
149
 
151
150
  New feature development should focus on the Aliki theme. Darkfish will continue to receive bug fixes but no new features.
152
151
 
@@ -160,13 +159,12 @@ lib/rdoc/
160
159
  ├── version.rb # Version constant
161
160
  ├── task.rb # Rake task integration
162
161
  ├── parser/ # Source code parsers
163
- │ ├── ruby.rb # Ruby code parser
162
+ │ ├── ruby.rb # Prism-based Ruby parser
164
163
  │ ├── c.rb # C extension parser
165
- │ ├── prism_ruby.rb # Prism-based Ruby parser
166
164
  │ └── ...
167
165
  ├── generator/ # Documentation generators
168
166
  │ ├── aliki.rb # HTML generator (default theme)
169
- │ ├── darkfish.rb # HTML generator (deprecated, will be removed in v8.0)
167
+ │ ├── darkfish.rb # HTML generator (deprecated, will be removed in v9.0)
170
168
  │ ├── markup.rb # Markup format generator
171
169
  │ ├── ri.rb # RI command generator
172
170
  │ └── template/ # ERB templates
@@ -177,8 +175,7 @@ lib/rdoc/
177
175
  ├── markdown.kpeg # Parser source (edit this)
178
176
  ├── markdown.rb # Generated parser (do not edit)
179
177
  ├── markdown/ # Markdown parsing
180
- │ ├── literals.kpeg # Parser source (edit this)
181
- │ └── literals.rb # Generated parser (do not edit)
178
+ │ └── byte_runtime.rb # Byte-offset parser runtime
182
179
  ├── rd/ # RD format parsing
183
180
  │ ├── block_parser.ry # Parser source (edit this)
184
181
  │ ├── block_parser.rb # Generated parser (do not edit)
data/LICENSE.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ :stopdoc:
2
+ SPDX-License-Identifier: Ruby or GPL-2.0-only
3
+ :startdoc:
4
+
1
5
  = License
2
6
 
3
7
  RDoc is copyrighted free software.
data/README.md CHANGED
@@ -3,6 +3,10 @@
3
3
  - GitHub: [https://github.com/ruby/rdoc](https://github.com/ruby/rdoc)
4
4
  - Issues: [https://github.com/ruby/rdoc/issues](https://github.com/ruby/rdoc/issues)
5
5
 
6
+ <p align="center" class="rdoc-logo">
7
+ <img src="rdoc-logo.svg" alt="RDoc" width="168" height="198">
8
+ </p>
9
+
6
10
  ## Description
7
11
 
8
12
  RDoc produces HTML and command-line documentation for Ruby projects. RDoc includes the `rdoc` and `ri` tools for generating and displaying documentation from the command-line.
@@ -37,7 +41,9 @@ rdoc --main README.md
37
41
 
38
42
  You'll find information on the various formatting tricks you can use in comment blocks in the documentation this generates.
39
43
 
40
- RDoc uses file extensions to determine how to process each file. File names ending `.rb` and `.rbw` are assumed to be Ruby source. Files ending `.c` are parsed as C files. All other files are assumed to contain just Markup-style markup (with or without leading `#` comment markers). If directory names are passed to RDoc, they are scanned recursively for C and Ruby source files only.
44
+ RDoc uses file extensions to determine how to process each file. File names ending `.rb` and `.rbw` are assumed to be Ruby source. Files ending `.c` are parsed as C files. Files ending `.rbs` are parsed as RBS signature files. All other files are assumed to contain just Markup-style markup (with or without leading `#` comment markers). If directory names are passed to RDoc, they are scanned recursively for C, Ruby, and RBS source files.
45
+
46
+ RBS files can document classes, modules, methods, attributes, and constants. When RBS declarations match objects already documented from Ruby source, their comments and type signatures extend the existing documentation.
41
47
 
42
48
  To generate documentation using `rake` see [RDoc::Task](https://ruby.github.io/rdoc/RDoc/Task.html).
43
49
 
@@ -159,7 +165,7 @@ To determine how well your project is documented run `rdoc -C lib` to get a docu
159
165
  RDoc ships with two built-in themes:
160
166
 
161
167
  - **Aliki** (default) - A modern, clean theme with improved navigation and search
162
- - **Darkfish** (deprecated) - The classic theme, will be removed in v8.0
168
+ - **Darkfish** (deprecated) - The classic theme, will be removed in v9.0
163
169
 
164
170
  To use the Darkfish theme instead of the default Aliki theme:
165
171
 
@@ -180,6 +186,41 @@ There are also a few community-maintained themes for RDoc:
180
186
 
181
187
  Please follow the theme's README for usage instructions.
182
188
 
189
+ ## Live Preview Server
190
+
191
+ RDoc includes a built-in server for previewing documentation while you edit source files. It parses your code once on startup, then watches for changes and auto-refreshes the browser.
192
+
193
+ ```shell
194
+ rdoc --server
195
+ ```
196
+
197
+ This starts a server at `http://localhost:4000`. You can specify a different port:
198
+
199
+ ```shell
200
+ rdoc --server=8080
201
+ ```
202
+
203
+ Or use the Rake task:
204
+
205
+ ```shell
206
+ rake rdoc:server
207
+ ```
208
+
209
+ ### How It Works
210
+
211
+ - Parses all source files on startup and serves pages from memory using the Aliki theme
212
+ - A background thread polls file mtimes every second
213
+ - When a file changes, only that file is re-parsed — the browser refreshes automatically
214
+ - New files are detected and added; deleted files are removed
215
+
216
+ **No external dependencies.** The server uses Ruby's built-in `TCPServer` (`socket` stdlib) — no WEBrick or other gems required.
217
+
218
+ ### Limitations
219
+
220
+ - **Reopened classes and file deletion.** If a class is defined across multiple files (e.g. `Foo` in both `a.rb` and `b.rb`), deleting one file removes the entire class from the store, including parts from the other file. Saving the remaining file triggers a re-parse that restores it.
221
+ - **Full cache invalidation.** Any file change clears all cached pages. This is simple and correct — rendering is fast (~ms per page), parsing is the expensive part and is done incrementally.
222
+ - **No HTTPS or HTTP/2.** The server is intended for local development preview only.
223
+
183
224
  ## Bugs
184
225
 
185
226
  See [CONTRIBUTING.md](CONTRIBUTING.md) for information on filing a bug report. It's OK to file a bug report for anything you're having a problem with. If you can't figure out how to make RDoc produce the output you like that is probably a documentation bug.
data/RI.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # `ri`: Ruby Information
2
2
 
3
- `ri` (<b>r</b>uby <b>i</b>nformation) is the Ruby command-line utility
4
- that gives fast and easy on-line access to Ruby documentation.
3
+ `ri` (<b>r</b>uby <b>i</b>nformation) is a Ruby command-line utility
4
+ that gives fast and easy online access to Ruby documentation.
5
5
 
6
6
  `ri` can show documentation for Ruby itself and for its installed gems:
7
7
 
@@ -45,10 +45,10 @@ the [Ruby online documentation](https://docs.ruby-lang.org/en/master):
45
45
 
46
46
  - The `ri` documentation is always available, even when you do not have internet access
47
47
  (think: airplane mode).
48
- - If you are working in a terminal window, typing `ri _whatever_` (or just `ri`)
48
+ - If you are working in a terminal window, typing `ri <whatever>` (or just `ri`)
49
49
  may be faster than navigating to a browser window and searching for documentation.
50
50
  - If you are working in an
51
- [irb \(interactive Ruby\)](https://ruby.github.io/irb/index.html)
51
+ [IRB \(Interactive Ruby\)][9]
52
52
  session, you _already_ have immediate access to `ri`:
53
53
  just type `'show_doc'`.
54
54
 
@@ -82,7 +82,7 @@ In both modes, static and interactive,
82
82
  `ri` responds to an input _name_ that specifies what is to be displayed:
83
83
  a document, multiple documents, or other information:
84
84
 
85
- - Static mode (in the shell): type `'ri _name_'`;
85
+ - Static mode (in the shell): run `ri <name>`;
86
86
  examples (output omitted):
87
87
 
88
88
  ```sh
@@ -109,17 +109,17 @@ a document, multiple documents, or other information:
109
109
  These example `ri` commands cite names for class and module documents
110
110
  (see [details and examples][3]):
111
111
 
112
- | Command | Shows |
113
- |------------------------------|------------------------------------------------------------|
114
- | ri File | Document for Ruby class File. |
115
- | ri File::Stat | Document for Ruby nested class File::Stat. |
116
- | ri Enumerable | Document for Ruby module Enumerable. |
117
- | ri Arr | Document for Ruby class Array (unique initial characters). |
118
- | ri Nokogiri::HTML4::Document | Document for gem class Nokogiri::HTML4::Document. |
119
- | ri Nokogiri | Document for gem module Nokogiri. |
112
+ | Command | Shows |
113
+ |--------------------------------|--------------------------------------------------------------|
114
+ | `ri File` | Document for Ruby class `File`. |
115
+ | `ri File::Stat` | Document for Ruby nested class `File::Stat`. |
116
+ | `ri Enumerable` | Document for Ruby module `Enumerable`. |
117
+ | `ri Arr` | Document for Ruby class `Array` (unique initial characters). |
118
+ | `ri Nokogiri::HTML4::Document` | Document for gem class `Nokogiri::HTML4::Document`. |
119
+ | `ri Nokogiri` | Document for gem module `Nokogiri`. |
120
120
  <br>
121
121
 
122
- If [option \\--all][4]
122
+ If [option `--all`][4]
123
123
  is in effect, documents for the methods in the named class or module
124
124
  are included in the display.
125
125
 
@@ -128,16 +128,16 @@ are included in the display.
128
128
  These example `ri` commands cite names for method documents
129
129
  (see [details and examples][5]):
130
130
 
131
- | Command | Shows |
132
- |--------------------------------------|----------------------------------------------------------------------------------|
133
- | ri IO::readlines | Document for Ruby class method IO::readlines. |
134
- | ri IO#readlines | Document for Ruby instance method IO::readlines. |
135
- | ri IO.readlines | Documents for Ruby instance method IO::readlines and class method IO::readlines. |
136
- | ri ::readlines | Documents for all class methods ::readlines. |
137
- | ri #readlines | Documents for all instance methods #readlines. |
138
- | ri .readlines, ri readlines | Documents for class methods ::readlines and instance methods #readlines. |
139
- | ri Nokogiri::HTML4::Document::parse | Document for gem class method Nokogiri::HTML4::Document::parse. |
140
- | ri Nokogiri::HTML4::Document#fragment | Document for gem instance method Nokogiri::HTML4::Document#fragment. |
131
+ | Command | Shows |
132
+ |-----------------------------------------|--------------------------------------------------------------------------------------|
133
+ | `ri IO::readlines` | Document for Ruby class method `IO::readlines`. |
134
+ | `ri IO#readlines` | Document for Ruby instance method `IO#readlines`. |
135
+ | `ri IO.readlines` | Documents for Ruby class method `IO::readlines` and instance method `IO#readlines`. |
136
+ | `ri ::readlines` | Documents for all class methods `::readlines`. |
137
+ | `ri #readlines` | Documents for all instance methods `#readlines`. |
138
+ | `ri .readlines`, `ri readlines` | Documents for all class methods `::readlines` and all instance methods `#readlines`. |
139
+ | `ri Nokogiri::HTML4::Document::parse` | Document for gem class method `Nokogiri::HTML4::Document::parse`. |
140
+ | `ri Nokogiri::HTML4::Document#fragment` | Document for gem instance method `Nokogiri::HTML4::Document#fragment`. |
141
141
  <br>
142
142
 
143
143
  ### Names for Page Documents
@@ -145,12 +145,12 @@ These example `ri` commands cite names for method documents
145
145
  These example `ri` commands cite names for page documents
146
146
  (see [details and examples][6]):
147
147
 
148
- | Command | Shows |
149
- |--------------------------------|--------------------------------------------------|
150
- | ri ruby:syntax/assignment.rdoc | Document for Ruby page assignment. |
151
- | ri ruby:syntax/assignment | Same document, if no other syntax/assignment.*. |
152
- | ri ruby:assignment | Same document, if no other */assignment.*. |
153
- | ri nokogiri:README.md | Document for page README.md. |
148
+ | Command | Shows |
149
+ |----------------------------------|----------------------------------------------------|
150
+ | `ri ruby:syntax/assignment.rdoc` | Document for Ruby page "assignment". |
151
+ | `ri ruby:syntax/assignment` | Same document, if no other "syntax/assignment.\*". |
152
+ | `ri ruby:assignment` | Same document, if no other "\*/assignment.\*". |
153
+ | `ri nokogiri:README.md` | Document for page "README.md". |
154
154
  <br>
155
155
 
156
156
  ### Names for Lists
@@ -158,14 +158,14 @@ These example `ri` commands cite names for page documents
158
158
  These example `ri` commands cite names for lists
159
159
  (see [details and examples][7]):
160
160
 
161
- | Command | Shows |
162
- |---------------|-------------------------|
163
- | ri ruby: | List of Ruby pages. |
164
- | ri nokogiri: | List of Nokogiri pages. |
161
+ | Command | Shows |
162
+ |----------------|-------------------------|
163
+ | `ri ruby:` | List of Ruby pages. |
164
+ | `ri nokogiri:` | List of Nokogiri pages. |
165
165
  <br>
166
166
 
167
167
  There are more lists available;
168
- see [option \\--list][8].
168
+ see [option `--list`][8].
169
169
 
170
170
  ## Pro Tips
171
171
 
@@ -175,8 +175,8 @@ If you are a frequent `ri` user,
175
175
  you can save time by keeping open a dedicated command window
176
176
  with either of:
177
177
 
178
- - A running [interactive ri][2] session.
179
- - A running [irb session][9];
178
+ - A running [interactive `ri`][2] session.
179
+ - A running [`irb` session][9];
180
180
  type `'show_doc'` to enter `ri`, newline to exit.
181
181
 
182
182
  When you switch to that window, `ri` is ready to respond quickly,
@@ -199,7 +199,7 @@ $ RI_PAGER="grep . | less" ri Array
199
199
  ```
200
200
 
201
201
  See the documentation for your chosen pager programs
202
- (e.g, type `'grep --help'`, `'less --help'`).
202
+ (e.g, run `grep --help`, `less --help`).
203
203
 
204
204
  ### Links in `ri` Output
205
205
 
@@ -254,10 +254,10 @@ When you see:
254
254
  - `ri` output can be large;
255
255
  to save space, an example may pipe it to one of these:
256
256
 
257
- - [head](https://www.man7.org/linux/man-pages/man1/head.1.html): leading lines only.
258
- - [tail](https://www.man7.org/linux/man-pages/man1/tail.1.html): trailing lines only.
259
- - [wc -l](https://www.man7.org/linux/man-pages/man1/wc.1.html): line count only.
260
- - [grep](https://www.man7.org/linux/man-pages/man1/grep.1.html): selected lines only.
257
+ - [`head`](https://www.man7.org/linux/man-pages/man1/head.1.html): leading lines only.
258
+ - [`tail`](https://www.man7.org/linux/man-pages/man1/tail.1.html): trailing lines only.
259
+ - [`wc -l`](https://www.man7.org/linux/man-pages/man1/wc.1.html): line count only.
260
+ - [`grep`](https://www.man7.org/linux/man-pages/man1/grep.1.html): selected lines only.
261
261
 
262
262
  - An example that involves a gem assumes that gems `nokogiri` and `minitest` are installed.
263
263
 
@@ -268,15 +268,15 @@ in the `ri` document for a class, module, method, or page.
268
268
 
269
269
  See also:
270
270
 
271
- - [Pager][10].
272
- - [Links in ri Output][11].
271
+ - [Pager][10]
272
+ - [Links in `ri` Output][11]
273
273
 
274
274
  ### Class and Module Documents
275
275
 
276
276
  The document for a class or module shows:
277
277
 
278
- - The class or module name, along with its parent class if any.
279
- - Where it's defined (Ruby core or gem).
278
+ - The class or module name, along with its parent class, if any.
279
+ - Where it's defined (Ruby core or a gem).
280
280
  - When each exists:
281
281
 
282
282
  - The names of its included modules.
@@ -335,7 +335,7 @@ $ ri IO | grep "^= "
335
335
 
336
336
  The document for a method includes:
337
337
 
338
- - The source of the method: `'(from ruby core)'` or `'(from gem _gem_)'`.
338
+ - The source of the method: `'(from ruby core)'` or `'(from gem <gem>)'`.
339
339
  - The calling sequence(s) for the method.
340
340
  - The text of its embedded documentation (if it exists).
341
341
 
@@ -374,7 +374,7 @@ the number of such implementations depends on the _name_:
374
374
  - Within a class:
375
375
 
376
376
  Each of these commands shows documents
377
- for methods in Ruby class `IO` (output omitted):
377
+ for methods in the Ruby class `IO` (output omitted):
378
378
 
379
379
  ```sh
380
380
  $ ri IO::readlines # Class method ::readlines.
@@ -467,7 +467,7 @@ rdoc:
467
467
 
468
468
  ## `ri` Lists
469
469
 
470
- The list of Ruby pages is available via _name_ `'ruby:'`:
470
+ The list of Ruby pages is available via the _name_ `'ruby:'`:
471
471
 
472
472
  ```sh
473
473
  $ ri ruby: | head
@@ -497,7 +497,7 @@ syntax/refinements.rdoc
497
497
  win32/README.win32
498
498
  ```
499
499
 
500
- The list of gem pages is available via _name_ `'_gem_name_'`:
500
+ The list of gem pages is available via the _name_ `'<gem_name>:'`:
501
501
 
502
502
  ```sh
503
503
  $ ri nokogiri: | head
@@ -509,9 +509,9 @@ lib/nokogiri/css/tokenizer.rex
509
509
 
510
510
  See also:
511
511
 
512
- - [Option \\--list][8]:
512
+ - [Option `--list`][8]:
513
513
  lists classes and modules.
514
- - [Option \\--list-doc-dirs][12]:
514
+ - [Option `--list-doc-dirs`][12]:
515
515
  lists `ri` source directories.
516
516
 
517
517
  ## `ri` Information
@@ -519,12 +519,12 @@ See also:
519
519
  With certain options,
520
520
  an `ri` command may display information other than documents or lists:
521
521
 
522
- - [Option \\--help or -h][13]:
522
+ - [Option `--help` or `-h`][13]:
523
523
  Shows `ri` help text.
524
- - [option \\--version or -v][14]:
524
+ - [Option `--version` or `-v`][14]:
525
525
  Shows `ri` version.
526
- - [Option \\--dump=FILEPATH][15]:
527
- Shows dump of `ri` cache file at the given filepath.
526
+ - [Option `--dump=FILEPATH`][15]:
527
+ Shows a dump of `ri` cache file at the given filepath.
528
528
 
529
529
  ## Static Mode
530
530
 
@@ -549,7 +549,7 @@ elements. Any object may be an Array element.
549
549
 
550
550
  `ri` also responds in static mode when certain options are given,
551
551
  even when no _name_ is given;
552
- see [ri Information][16].
552
+ see [`ri` Information][16].
553
553
 
554
554
  ## Interactive Mode
555
555
 
@@ -565,18 +565,18 @@ Enter a blank line to exit.
565
565
 
566
566
  ```
567
567
 
568
- A command in interactive mode are similar to one in static mode,
568
+ A command in interactive mode is similar to one in static mode,
569
569
  except that it:
570
570
 
571
- - Omits command word `ri`; you just type the _name_.
571
+ - Omits the command word `ri`; you just type the _name_.
572
572
  - Omits options; in interactive mode the only options in effect
573
573
  are those taken from environment variable `RI`.
574
574
  See [Options][17].
575
575
  - Supports tab auto-completion for the name of a class, module, or method;
576
- when, for example, you type `"Arr\t"` (here `"\t` represents the tab character),
576
+ when, for example, you type `"Arr\t"` (here `\t` represents the tab character),
577
577
  `ri` "completes" the text as `'Array '`.
578
578
 
579
- See also [ri at the Ready][18].
579
+ See also [`ri` at the Ready][18].
580
580
 
581
581
  ## Pager
582
582
 
@@ -592,7 +592,7 @@ which is the program whose name is the first-found among:
592
592
 
593
593
  If none is found, the output goes directly to `$stdout`, with no pager.
594
594
 
595
- If you set environment variable `RI_PAGER` or `PAGER`,
595
+ If you set the environment variable `RI_PAGER` or `PAGER`,
596
596
  its value should be the name of an executable program
597
597
  that will accept the `ri` output (such as `'pager'`, `'less'`, or `'more'`).
598
598
 
@@ -601,9 +601,9 @@ See also [Output Filters][19].
601
601
  ## Options
602
602
 
603
603
  Options may be given on the `ri` command line;
604
- those should be whitespace-separated, and must precede the given _name_, if any.
604
+ those should be whitespace-separated and must precede the given _name_, if any.
605
605
 
606
- Options may also be specified in environment variable `RI`;
606
+ Options may also be specified in the environment variable `RI`;
607
607
  those should also be whitespace-separated.
608
608
 
609
609
  An option specified in environment variable `RI`
@@ -643,21 +643,21 @@ $ ri --list --no-gems| wc -l
643
643
 
644
644
  #### Options `--home`, `--no-home`
645
645
 
646
- Option `--home` (the default) specifies that `ri` is to include source directory
646
+ Option `--home` (the default) specifies that `ri` is to include the source directory
647
647
  in `~/.rdoc` if it exists;
648
- option `--no-home` may be used to exclude them.
648
+ option `--no-home` may be used to exclude it.
649
649
 
650
650
  #### Options `--list-doc-dirs`, `--no-list-doc-dirs`
651
651
 
652
652
  Option `--list-doc-dirs` specifies that a list of the `ri` source directories
653
653
  is to be displayed;
654
- default is `--no-list-doc-dirs`.
654
+ the default is `--no-list-doc-dirs`.
655
655
 
656
656
  #### Option `--no-standard`
657
657
 
658
658
  Option `--no-standard` specifies that documents from the standard libraries
659
659
  are not to be included;
660
- default is to include documents from the standard libraries.
660
+ the default is to include documents from the standard libraries.
661
661
 
662
662
  #### Options `--site`, `--no-site`
663
663
 
@@ -680,7 +680,7 @@ specifies that `ri` is to enter interactive mode (ignoring the _name_ if given);
680
680
  the option is the default when no _name_ is given;
681
681
  option `--no-interactive` (the default)
682
682
  specifies that `ri` is not to enter interactive mode,
683
- regardless of whether _name_ is given.
683
+ regardless of whether a _name_ is given.
684
684
 
685
685
  ### Information Options
686
686
 
@@ -785,7 +785,7 @@ is not to be displayed.
785
785
 
786
786
  #### Options `--all`, `-a`, `--no-all`
787
787
 
788
- Option `--all` (aliased as `-a`) specifies that when _name_ identifies a class or module,
788
+ Option `--all` (aliased as `-a`) specifies that when a _name_ identifies a class or module,
789
789
  the documents for all its methods are included;
790
790
  option `--no-all` (the default) specifies that the method documents are not to be included:
791
791
 
@@ -809,16 +809,16 @@ the default port is `8214`.
809
809
  `ri` by default reads data from directories installed by Ruby and gems.
810
810
 
811
811
  You can create your own `ri` source files.
812
- This command creates `ri` source files in local directory `my_ri`,
813
- from Ruby source files in local directory `my_sources`:
812
+ This command creates `ri` source files in the local directory `my_ri`,
813
+ from Ruby source files in the local directory `my_sources`:
814
814
 
815
815
  ```sh
816
816
  $ rdoc --op my_ri --format=ri my_sources
817
817
  ```
818
818
 
819
819
  Those files may then be considered for any `ri` command
820
- by specifying option `--doc-dir=my_ri`;
821
- see [option \\--doc-dir][20].
820
+ by specifying the option `--doc-dir=my_ri`;
821
+ see [option `--doc-dir`][20].
822
822
 
823
823
  [1]: rdoc-ref:RI.md@Static+Mode
824
824
  [2]: rdoc-ref:RI.md@Interactive+Mode
@@ -828,7 +828,7 @@ see [option \\--doc-dir][20].
828
828
  [6]: rdoc-ref:RI.md@Page+Documents
829
829
  [7]: rdoc-ref:RI.md@ri+Lists
830
830
  [8]: rdoc-ref:RI.md@Options+--list-2C+-l-2C+--no-list
831
- [9]: https://docs.ruby-lang.org/en/master/IRB.html
831
+ [9]: https://ruby.github.io/irb/
832
832
  [10]: rdoc-ref:RI.md@Pager
833
833
  [11]: rdoc-ref:RI.md@Links+in+ri+Output
834
834
  [12]: rdoc-ref:RI.md@Options+--list-doc-dirs-2C+--no-list-doc-dirs
@@ -98,7 +98,9 @@ Use triple backticks with an optional language identifier:
98
98
  end
99
99
  ```
100
100
 
101
- Supported language for syntax highlighting: `ruby`, `rb` (alias to `ruby`), and `c`.
101
+ Supported languages for syntax highlighting: `ruby` (and `rb` alias) with server-side
102
+ highlighting, and `c`, `bash`/`sh`/`shell`/`console` with client-side JavaScript highlighting.
103
+ Other info strings are accepted and added as a CSS class but receive no highlighting.
102
104
 
103
105
  ### Blockquotes
104
106
 
@@ -420,6 +422,9 @@ For example:
420
422
  * [Link to Blockquotes](#blockquotes)
421
423
  * [Link to Anchor Links](#anchor-links)
422
424
 
425
+ When multiple headings produce the same anchor, RDoc appends `-1`, `-2`, etc.
426
+ to subsequent duplicates, matching GitHub's behavior.
427
+
423
428
  ## Footnotes
424
429
 
425
430
  ### Reference Footnotes
@@ -535,7 +540,7 @@ See [rdoc.rdoc](rdoc.rdoc) for complete directive documentation.
535
540
  | Headings | `= Heading` | `# Heading` |
536
541
  | Bold | `*word*` | `**word**` |
537
542
  | Italic | `_word_` | `*word*` |
538
- | Monospace | `+word+` | `` `word` `` |
543
+ | Monospace | `+word+` or `` `word` `` | `` `word` `` |
539
544
  | Links | `{text}[url]` | `[text](url)` |
540
545
  | Code blocks | Indent beyond margin | Indent 4 spaces or fence |
541
546
  | Block quotes | `>>>` | `>` |
@@ -551,8 +556,104 @@ See [rdoc.rdoc](rdoc.rdoc) for complete directive documentation.
551
556
 
552
557
  3. **Footnotes are collapsed** - Multiple paragraphs in a footnote become a single paragraph.
553
558
 
554
- 4. **Syntax highlighting** - Only `ruby` and `c` are supported for fenced code blocks.
559
+ 4. **Syntax highlighting** - Only `ruby`/`rb` (server-side) and `c`, `bash`/`sh`/`shell`/`console` (client-side) receive syntax highlighting. Other info strings are accepted but not highlighted.
555
560
 
556
561
  5. **Fenced code blocks** - Only triple backticks are supported. Tilde fences (`~~~`) are not supported as they conflict with strikethrough syntax. Four or more backticks for nesting are also not supported.
557
562
 
558
563
  6. **Auto-linking** - RDoc automatically links class and method names in output, even without explicit link syntax.
564
+
565
+ ## Comparison with GitHub Flavored Markdown (GFM)
566
+
567
+ This section compares RDoc's Markdown implementation with the
568
+ [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) (Version 0.29-gfm, 2019-04-06).
569
+
570
+ ### Block Elements
571
+
572
+ | Feature | GFM | RDoc | Notes |
573
+ |---------|:---:|:----:|-------|
574
+ | ATX Headings (`#`) | ✅ | ✅ | Both support levels 1-6, optional closing `#` |
575
+ | Setext Headings | ✅ | ✅ | `=` for H1, `-` for H2 |
576
+ | Paragraphs | ✅ | ✅ | Full match |
577
+ | Indented Code Blocks | ✅ | ✅ | 4 spaces or 1 tab |
578
+ | Fenced Code (backticks) | ✅ 3+ | ⚠️ 3 only | RDoc doesn't support 4+ backticks for nesting |
579
+ | Fenced Code (tildes) | ✅ `~~~` | ❌ | Conflicts with strikethrough syntax |
580
+ | Info strings (language) | ✅ any | ⚠️ limited | `ruby`/`rb`, `c`, and `bash`/`sh`/`shell`/`console` highlighted; others accepted as CSS class |
581
+ | Blockquotes | ✅ | ✅ | Full match, nested supported |
582
+ | Lazy Continuation | ✅ | ⚠️ | Continuation text is included in blockquote but line break is lost (becomes a space) |
583
+ | Bullet Lists | ✅ | ✅ | `*`, `+`, `-` supported |
584
+ | Ordered Lists | ✅ `.` `)` | ⚠️ `.` only | RDoc doesn't support `)` delimiter; numbers are always renumbered from 1 |
585
+ | Nested Lists | ✅ | ✅ | 4-space indentation |
586
+ | Tables | ✅ | ✅ | Full alignment support |
587
+ | Thematic Breaks | ✅ | ✅ | `---`, `***`, `___` |
588
+ | HTML Blocks | ✅ 7 types | ⚠️ | See below |
589
+
590
+ #### HTML Blocks
591
+
592
+ GFM defines 7 types of HTML blocks:
593
+
594
+ | Type | Description | GFM | RDoc | Notes |
595
+ |------|-------------|:---:|:----:|-------|
596
+ | 1 | `<script>`, `<pre>` | ✅ | ✅ | |
597
+ | 1 | `<style>` | ✅ | ❌ | Available via `css` extension (disabled by default) |
598
+ | 2 | HTML comments `<!-- -->` | ✅ | ✅ | |
599
+ | 3 | Processing instructions `<? ?>` | ✅ | ❌ | |
600
+ | 4 | Declarations `<!DOCTYPE>` | ✅ | ❌ | |
601
+ | 5 | CDATA `<![CDATA[ ]]>` | ✅ | ❌ | |
602
+ | 6 | Block-level tags | ✅ | ⚠️ | |
603
+ | 7 | Any complete open/close tag | ✅ | ❌ | |
604
+
605
+ RDoc uses a whitelist of block-level tags defined in
606
+ [lib/rdoc/markdown.kpeg](https://github.com/ruby/rdoc/blob/master/lib/rdoc/markdown.kpeg)
607
+ (see `HtmlBlockInTags`). HTML5 semantic elements like `<article>`, `<section>`,
608
+ `<nav>`, `<header>`, `<footer>` are not supported.
609
+
610
+ ### Inline Elements
611
+
612
+ | Feature | GFM | RDoc | Notes |
613
+ |---------|:---:|:----:|-------|
614
+ | Emphasis `*text*` `_text_` | ✅ | ⚠️ | Intraword emphasis not supported (see [Notes](#notes-and-limitations)) |
615
+ | Strong `**text**` `__text__` | ✅ | ✅ | Full match |
616
+ | Combined `***text***` | ✅ | ✅ | Full match |
617
+ | Code spans | ✅ | ✅ | Multiple backticks supported |
618
+ | Inline links | ✅ | ✅ | Full match |
619
+ | Reference links | ✅ | ✅ | Full match |
620
+ | Link titles | ✅ | ⚠️ | Parsed but not rendered |
621
+ | Images | ✅ | ✅ | Full match |
622
+ | Autolinks `<url>` | ✅ | ✅ | Full match |
623
+ | Hard line breaks | ✅ | ⚠️ | 2+ trailing spaces only; backslash `\` at EOL not supported |
624
+ | Backslash escapes | ✅ | ⚠️ | Subset of GFM's escapable characters (e.g., `~` not escapable) |
625
+ | HTML entities | ✅ | ✅ | Named, decimal, hex |
626
+ | Inline HTML | ✅ | ⚠️ | `<b>` converted to `<strong>`, `<i>` to `<em>`; `<strong>` itself is escaped |
627
+
628
+ ### GFM Extensions
629
+
630
+ | Feature | GFM | RDoc | Notes |
631
+ |---------|:---:|:----:|-------|
632
+ | Strikethrough `~~text~~` | ✅ | ✅ | Full match |
633
+ | Task Lists `[ ]` `[x]` | ✅ | ❌ | Not supported |
634
+ | Extended Autolinks | ✅ | ⚠️ | See below |
635
+ | Disallowed Raw HTML | ✅ | ❌ | No security filtering |
636
+
637
+ #### GFM Extended Autolinks
638
+
639
+ GFM automatically converts certain text patterns into links without requiring
640
+ angle brackets (`<>`). RDoc also auto-links URLs and `www.` prefixes through
641
+ its cross-reference system, but the behavior differs from GFM.
642
+
643
+ GFM recognizes these patterns:
644
+
645
+ - `www.example.com` — text starting with `www.` followed by a valid domain
646
+ - `https://example.com` — URLs starting with `http://` or `https://`
647
+ - `user@example.com` — valid email addresses
648
+
649
+ RDoc auto-links `www.` prefixes and `http://`/`https://` URLs similarly to GFM.
650
+ However, bare email addresses like `user@example.com` are not auto-linked;
651
+ use `<user@example.com>` instead.
652
+
653
+ ### RDoc-Specific Features (not in GFM)
654
+
655
+ - [Definition Lists](#definition-lists)
656
+ - [Footnotes](#footnotes)
657
+ - [Cross-references](#cross-references)
658
+ - [Anchor Links](#anchor-links)
659
+ - [Directives](#directives)
data/exe/rdoc CHANGED
@@ -25,11 +25,11 @@ rescue Errno::ENOSPC
25
25
  rescue SystemExit
26
26
  raise
27
27
  rescue Exception => e
28
- if $DEBUG_RDOC then
28
+ if $DEBUG_RDOC
29
29
  $stderr.puts e.message
30
30
  $stderr.puts "#{e.backtrace.join "\n\t"}"
31
31
  $stderr.puts
32
- elsif Interrupt === e then
32
+ elsif Interrupt === e
33
33
  $stderr.puts
34
34
  $stderr.puts 'Interrupted'
35
35
  else