rdoc 6.17.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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +193 -0
  3. data/LEGAL.rdoc +6 -0
  4. data/LICENSE.rdoc +4 -0
  5. data/README.md +132 -8
  6. data/RI.md +75 -75
  7. data/doc/markup_reference/markdown.md +659 -0
  8. data/doc/markup_reference/rdoc.rdoc +1169 -0
  9. data/exe/rdoc +2 -2
  10. data/lib/rdoc/code_object/alias.rb +70 -74
  11. data/lib/rdoc/code_object/any_method.rb +308 -293
  12. data/lib/rdoc/code_object/attr.rb +150 -142
  13. data/lib/rdoc/code_object/class_module.rb +802 -715
  14. data/lib/rdoc/code_object/constant.rb +181 -144
  15. data/lib/rdoc/code_object/context/section.rb +140 -130
  16. data/lib/rdoc/code_object/context.rb +925 -941
  17. data/lib/rdoc/code_object/extend.rb +7 -5
  18. data/lib/rdoc/code_object/include.rb +7 -5
  19. data/lib/rdoc/code_object/method_attr.rb +328 -315
  20. data/lib/rdoc/code_object/mixin.rb +97 -92
  21. data/lib/rdoc/code_object/normal_class.rb +77 -78
  22. data/lib/rdoc/code_object/normal_module.rb +61 -59
  23. data/lib/rdoc/code_object/require.rb +23 -39
  24. data/lib/rdoc/code_object/single_class.rb +21 -19
  25. data/lib/rdoc/code_object/top_level.rb +215 -202
  26. data/lib/rdoc/code_object.rb +305 -305
  27. data/lib/rdoc/comment.rb +274 -337
  28. data/lib/rdoc/cross_reference.rb +195 -206
  29. data/lib/rdoc/encoding.rb +105 -103
  30. data/lib/rdoc/erb_partial.rb +13 -11
  31. data/lib/rdoc/erbio.rb +29 -27
  32. data/lib/rdoc/generator/aliki.rb +196 -30
  33. data/lib/rdoc/generator/darkfish.rb +647 -629
  34. data/lib/rdoc/generator/json_index.rb +233 -229
  35. data/lib/rdoc/generator/markup.rb +165 -122
  36. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  37. data/lib/rdoc/generator/pot/po.rb +52 -51
  38. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  39. data/lib/rdoc/generator/pot.rb +85 -81
  40. data/lib/rdoc/generator/ri.rb +23 -19
  41. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  42. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  43. data/lib/rdoc/generator/template/aliki/_footer.rhtml +2 -2
  44. data/lib/rdoc/generator/template/aliki/_head.rhtml +15 -10
  45. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  46. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  47. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  48. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  49. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +3 -3
  50. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +3 -3
  51. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  52. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  53. data/lib/rdoc/generator/template/aliki/class.rhtml +71 -61
  54. data/lib/rdoc/generator/template/aliki/css/rdoc.css +796 -323
  55. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/js/aliki.js +119 -113
  57. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  58. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +1 -1
  59. data/lib/rdoc/generator/template/aliki/js/{search.js → search_controller.js} +16 -7
  60. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  61. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  62. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  63. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  64. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  65. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  66. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  67. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  68. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  69. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +2 -2
  70. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  71. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  72. data/lib/rdoc/generator/template/darkfish/class.rhtml +29 -32
  73. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -1
  74. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  75. data/lib/rdoc/generator.rb +48 -46
  76. data/lib/rdoc/i18n/locale.rb +99 -95
  77. data/lib/rdoc/i18n/text.rb +109 -105
  78. data/lib/rdoc/i18n.rb +7 -5
  79. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  80. data/lib/rdoc/markdown.kpeg +52 -33
  81. data/lib/rdoc/markdown.rb +365 -177
  82. data/lib/rdoc/markup/blank_line.rb +25 -23
  83. data/lib/rdoc/markup/block_quote.rb +12 -8
  84. data/lib/rdoc/markup/document.rb +127 -123
  85. data/lib/rdoc/markup/element.rb +21 -0
  86. data/lib/rdoc/markup/formatter.rb +220 -203
  87. data/lib/rdoc/markup/hard_break.rb +30 -27
  88. data/lib/rdoc/markup/heading.rb +163 -77
  89. data/lib/rdoc/markup/include.rb +33 -29
  90. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  91. data/lib/rdoc/markup/inline_parser.rb +316 -0
  92. data/lib/rdoc/markup/list.rb +80 -88
  93. data/lib/rdoc/markup/list_item.rb +73 -85
  94. data/lib/rdoc/markup/paragraph.rb +23 -19
  95. data/lib/rdoc/markup/parser.rb +501 -497
  96. data/lib/rdoc/markup/pre_process.rb +284 -305
  97. data/lib/rdoc/markup/raw.rb +52 -55
  98. data/lib/rdoc/markup/rule.rb +16 -12
  99. data/lib/rdoc/markup/table.rb +48 -40
  100. data/lib/rdoc/markup/to_ansi.rb +143 -92
  101. data/lib/rdoc/markup/to_bs.rb +86 -102
  102. data/lib/rdoc/markup/to_html.rb +608 -506
  103. data/lib/rdoc/markup/to_html_crossref.rb +219 -210
  104. data/lib/rdoc/markup/to_html_snippet.rb +210 -205
  105. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  106. data/lib/rdoc/markup/to_label.rb +64 -51
  107. data/lib/rdoc/markup/to_markdown.rb +212 -184
  108. data/lib/rdoc/markup/to_rdoc.rb +341 -277
  109. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  110. data/lib/rdoc/markup/to_test.rb +62 -50
  111. data/lib/rdoc/markup/to_tt_only.rb +83 -92
  112. data/lib/rdoc/markup/verbatim.rb +62 -58
  113. data/lib/rdoc/markup.rb +196 -215
  114. data/lib/rdoc/options.rb +1063 -1076
  115. data/lib/rdoc/parser/c.rb +1039 -1036
  116. data/lib/rdoc/parser/changelog.rb +320 -287
  117. data/lib/rdoc/parser/markdown.rb +17 -13
  118. data/lib/rdoc/parser/rbs.rb +279 -0
  119. data/lib/rdoc/parser/rd.rb +17 -13
  120. data/lib/rdoc/parser/ruby.rb +1231 -2222
  121. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  122. data/lib/rdoc/parser/simple.rb +31 -27
  123. data/lib/rdoc/parser/text.rb +12 -8
  124. data/lib/rdoc/parser.rb +230 -221
  125. data/lib/rdoc/rbs_helper.rb +186 -0
  126. data/lib/rdoc/rd/inline.rb +57 -53
  127. data/lib/rdoc/rd.rb +90 -88
  128. data/lib/rdoc/rdoc.rb +547 -366
  129. data/lib/rdoc/ri/driver.rb +1141 -1130
  130. data/lib/rdoc/ri/formatter.rb +7 -3
  131. data/lib/rdoc/ri/paths.rb +140 -136
  132. data/lib/rdoc/ri/servlet.rb +456 -0
  133. data/lib/rdoc/ri/store.rb +4 -2
  134. data/lib/rdoc/ri/task.rb +55 -51
  135. data/lib/rdoc/ri.rb +14 -11
  136. data/lib/rdoc/rubygems_hook.rb +194 -192
  137. data/lib/rdoc/server.rb +462 -0
  138. data/lib/rdoc/stats/normal.rb +46 -42
  139. data/lib/rdoc/stats/quiet.rb +39 -35
  140. data/lib/rdoc/stats/verbose.rb +35 -31
  141. data/lib/rdoc/stats.rb +363 -338
  142. data/lib/rdoc/store.rb +919 -725
  143. data/lib/rdoc/task.rb +260 -255
  144. data/lib/rdoc/text.rb +164 -240
  145. data/lib/rdoc/token_stream.rb +88 -106
  146. data/lib/rdoc/tom_doc.rb +203 -201
  147. data/lib/rdoc/version.rb +1 -1
  148. data/lib/rdoc.rb +35 -7
  149. data/lib/rubygems_plugin.rb +2 -11
  150. data/rdoc-logo.svg +43 -0
  151. data/rdoc.gemspec +9 -7
  152. metadata +46 -32
  153. data/CONTRIBUTING.rdoc +0 -219
  154. data/ExampleMarkdown.md +0 -39
  155. data/ExampleRDoc.rdoc +0 -210
  156. data/lib/rdoc/code_object/anon_class.rb +0 -10
  157. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  158. data/lib/rdoc/code_object/meta_method.rb +0 -6
  159. data/lib/rdoc/markdown/literals.kpeg +0 -21
  160. data/lib/rdoc/markdown/literals.rb +0 -454
  161. data/lib/rdoc/markup/attr_changer.rb +0 -22
  162. data/lib/rdoc/markup/attr_span.rb +0 -35
  163. data/lib/rdoc/markup/attribute_manager.rb +0 -405
  164. data/lib/rdoc/markup/attributes.rb +0 -70
  165. data/lib/rdoc/markup/regexp_handling.rb +0 -40
  166. data/lib/rdoc/parser/prism_ruby.rb +0 -1100
  167. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  168. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  169. data/lib/rdoc/servlet.rb +0 -452
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bb82d9eff1cf5ae3ee5276c97b12d57694d28c64a70ee9f318d4468c904999e
4
- data.tar.gz: f7073f27e9b4a15e3b7792f777bb8b2bc991bde74409e15cdb5bd7be1900f2db
3
+ metadata.gz: 8bd46d161ae9d2249a6e2ea1afdb46e08cdc737260427c472fe39981d6ea6d00
4
+ data.tar.gz: 81e455d982e6e564e84058ba420aa59ee9d7792f93de961051d705bada6cd4f0
5
5
  SHA512:
6
- metadata.gz: 76a11b7a7529c4b008488ba22f4aa0c8c5dd2cbfff19ec795f0fa5f16e0d7c7f4913d69c2cc11d18653f8d0a4bde559f2b2a893b9dba9d8aec34faaec557b935
7
- data.tar.gz: 5af47e79dc6fde12b8aa9809a0eb845db18031a907140484ea95ef16399a592c879445b8f725ae4eabfbfe5d3250656926698fa2a35b3426605420ca9961579f
6
+ metadata.gz: 3a9fb465374b2b6fa07e949c50284394377b48657de07da3a78604f2b646558a4ebe4dc06aaea4e773f185370256971c5563159ab1c0dab6bd5b65cc3e2a94f3
7
+ data.tar.gz: 99b8a3b9ac9b568a4ab8a23fa3cd5dd6b1385f562d800a54094d533bf153b3696337d217df999f94c88236049a357f3fa655b592cba7106f50829e9d72f4d02f
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,193 @@
1
+ # Contributing to RDoc
2
+
3
+ Thank you for your interest in contributing to RDoc! This document provides guidelines and instructions for contributing.
4
+
5
+ ## Reporting Bugs
6
+
7
+ If you think you found a bug, open an issue on the [issue tracker](https://github.com/ruby/rdoc/issues) on GitHub.
8
+
9
+ When reporting a bug:
10
+
11
+ - Include a sample file that illustrates the problem, or link to the repository/gem associated with the bug
12
+ - Include steps to reproduce the issue
13
+
14
+ ## Development Setup
15
+
16
+ RDoc uses Bundler for development. To get started:
17
+
18
+ ```bash
19
+ bundle install
20
+ bundle exec rake
21
+ ```
22
+
23
+ This will install dependencies and run the tests.
24
+
25
+ If you're working on CSS or templates, you'll also want Node dependencies for the CSS linter:
26
+
27
+ ```bash
28
+ npm install
29
+ ```
30
+
31
+ If tests don't pass on the first run, check the [GitHub Actions page](https://github.com/ruby/rdoc/actions) to see if there are any known failures.
32
+
33
+ **Note:** Generated parser files are committed to the repository. If you delete them (for example via `bundle exec rake clean`) or you change any `.ry`/`.kpeg` parser sources, run `bundle exec rake generate` before running tests.
34
+
35
+ ## Running Tests
36
+
37
+ ```bash
38
+ # Run all tests (default task)
39
+ bundle exec rake
40
+
41
+ # Run unit tests only (excludes RubyGems integration)
42
+ bundle exec rake normal_test
43
+
44
+ # Run RubyGems integration tests only
45
+ bundle exec rake rubygems_test
46
+
47
+ # Verify generated parser files are current (CI check)
48
+ bundle exec rake verify_generated
49
+ ```
50
+
51
+ - **Test Framework:** [`test-unit`](https://github.com/test-unit/test-unit)
52
+ - **Test Location:** `test/` directory
53
+ - **Test Helper:** `test/lib/helper.rb`
54
+
55
+ ## Linting
56
+
57
+ ### RuboCop (Ruby Code)
58
+
59
+ ```bash
60
+ # Check Ruby code style
61
+ bundle exec rubocop
62
+
63
+ # Auto-fix style issues
64
+ bundle exec rubocop -A
65
+ ```
66
+
67
+ ### Herb Linter (ERB/RHTML Templates)
68
+
69
+ ```bash
70
+ # Lint ERB template files
71
+ npx @herb-tools/linter "**/*.rhtml"
72
+
73
+ # Lint specific directory
74
+ npx @herb-tools/linter "lib/**/*.rhtml"
75
+ ```
76
+
77
+ **Template Location:** `lib/rdoc/generator/template/**/*.rhtml`
78
+
79
+ ### Stylelint (CSS Files)
80
+
81
+ ```bash
82
+ # Lint CSS files
83
+ npm run lint:css
84
+
85
+ # Auto-fix style issues
86
+ npm run lint:css -- --fix
87
+ ```
88
+
89
+ ## Type annotations
90
+
91
+ RDoc is currently not a typed codebase. Despite not running a type checker, contributors have been
92
+ adding some comment annotations to make the codebase easier to navigate and understand.
93
+
94
+ These annotations use [Sorbet flavored RBS](https://sorbet.org/docs/rbs-support) annotations,
95
+ so that we can tag definitions as abstract and override. For more information on RBS syntax,
96
+ see the [documentation](https://github.com/ruby/rbs/blob/master/docs/syntax.md).
97
+
98
+ ## Parser Generation
99
+
100
+ RDoc uses generated parsers for Markdown and RD formats.
101
+
102
+ ```bash
103
+ # Generate all parser files from sources
104
+ bundle exec rake generate
105
+
106
+ # Remove generated parser files
107
+ bundle exec rake clean
108
+
109
+ # Verify generated files are in sync with sources (CI check)
110
+ bundle exec rake verify_generated
111
+ ```
112
+
113
+ **Source Files** (edit these):
114
+
115
+ - `lib/rdoc/rd/block_parser.ry` → generates `block_parser.rb` via racc
116
+ - `lib/rdoc/rd/inline_parser.ry` → generates `inline_parser.rb` via racc
117
+ - `lib/rdoc/markdown.kpeg` → generates `markdown.rb` via kpeg
118
+
119
+ **Important:**
120
+
121
+ - Generated parser files **should be committed** to the repository
122
+ - Do not edit generated `.rb` parser files directly
123
+ - After modifying `.ry` or `.kpeg` source files, run `bundle exec rake generate`
124
+ - CI runs `rake verify_generated` to ensure generated files are in sync with their sources
125
+
126
+ ## Documentation Generation
127
+
128
+ ```bash
129
+ # Generate documentation (creates _site directory)
130
+ bundle exec rake rdoc
131
+
132
+ # Force regenerate documentation
133
+ bundle exec rake rerdoc
134
+
135
+ # Show documentation coverage
136
+ bundle exec rake rdoc:coverage
137
+ bundle exec rake coverage
138
+ ```
139
+
140
+ - **Output Directory:** `_site/` (GitHub Pages compatible)
141
+ - **Configuration:** `.rdoc_options` and `.document`
142
+
143
+ ## Themes
144
+
145
+ RDoc ships with two HTML themes:
146
+
147
+ - **Aliki** (default) - Modern theme with improved styling and navigation
148
+ - **Darkfish** (deprecated) - Classic theme, will be removed in v9.0
149
+
150
+ New feature development should focus on the Aliki theme. Darkfish will continue to receive bug fixes but no new features.
151
+
152
+ Theme templates are located at `lib/rdoc/generator/template/<theme>/`.
153
+
154
+ ## Project Structure
155
+
156
+ ```
157
+ lib/rdoc/
158
+ ├── rdoc.rb # Main entry point (RDoc::RDoc class)
159
+ ├── version.rb # Version constant
160
+ ├── task.rb # Rake task integration
161
+ ├── parser/ # Source code parsers
162
+ │ ├── ruby.rb # Prism-based Ruby parser
163
+ │ ├── c.rb # C extension parser
164
+ │ └── ...
165
+ ├── generator/ # Documentation generators
166
+ │ ├── aliki.rb # HTML generator (default theme)
167
+ │ ├── darkfish.rb # HTML generator (deprecated, will be removed in v9.0)
168
+ │ ├── markup.rb # Markup format generator
169
+ │ ├── ri.rb # RI command generator
170
+ │ └── template/ # ERB templates
171
+ │ ├── aliki/ # Aliki theme (default)
172
+ │ └── darkfish/ # Darkfish theme (deprecated)
173
+ ├── markup/ # Markup parsing and formatting
174
+ ├── code_object/ # AST objects for documented items
175
+ ├── markdown.kpeg # Parser source (edit this)
176
+ ├── markdown.rb # Generated parser (do not edit)
177
+ ├── markdown/ # Markdown parsing
178
+ │ └── byte_runtime.rb # Byte-offset parser runtime
179
+ ├── rd/ # RD format parsing
180
+ │ ├── block_parser.ry # Parser source (edit this)
181
+ │ ├── block_parser.rb # Generated parser (do not edit)
182
+ │ ├── inline_parser.ry # Parser source (edit this)
183
+ │ └── inline_parser.rb # Generated parser (do not edit)
184
+ └── ri/ # RI (Ruby Info) tool
185
+
186
+ test/ # Test files
187
+ ├── lib/helper.rb # Test helpers
188
+ └── rdoc/ # Main test directory
189
+ ```
190
+
191
+ ## Code of Conduct
192
+
193
+ Please be respectful and constructive in all interactions. We're all here to make RDoc better!
data/LEGAL.rdoc CHANGED
@@ -4,6 +4,12 @@
4
4
 
5
5
  The files in this distribution are covered by the Ruby license (see LICENSE) except the features mentioned below:
6
6
 
7
+ Aliki::
8
+ Aliki was written by Stan Lo and is included under the MIT license.
9
+
10
+ * lib/rdoc/generator/aliki.rb
11
+ * lib/rdoc/generator/template/aliki/*
12
+
7
13
  Darkfish::
8
14
  Darkfish was written by Michael Granger and is included under the BSD 3-Clause
9
15
  license. Darkfish contains images from the Silk Icons set by Mark James.
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
 
@@ -48,7 +54,7 @@ require 'rdoc/rdoc'
48
54
 
49
55
  options = RDoc::Options.new
50
56
  options.files = ['a.rb', 'b.rb']
51
- options.setup_generator 'darkfish'
57
+ options.setup_generator 'aliki'
52
58
  # see RDoc::Options
53
59
 
54
60
  rdoc = RDoc::RDoc.new
@@ -60,7 +66,7 @@ You can specify the target files for document generation with `.document` file i
60
66
 
61
67
  ## Writing Documentation
62
68
 
63
- To write documentation for RDoc place a comment above the class, module, method, constant, or attribute you want documented:
69
+ To write documentation for RDoc, place a comment above the class, module, method, constant, or attribute you want documented:
64
70
 
65
71
  ```rb
66
72
  ##
@@ -80,26 +86,144 @@ class Shape
80
86
  end
81
87
  ```
82
88
 
83
- The default comment markup format is the RDoc::Markup format. TomDoc, Markdown and RD format comments are also supported. You can set the default comment format for your entire project by creating a `.rdoc_options` file. See RDoc::Options@Saved+Options for instructions on creating one. You can also set the comment format for a single file through the `:markup:` directive, but this is only recommended if you wish to switch markup formats. See RDoc::Markup@Other+directives.
89
+ ### Markup Formats
90
+
91
+ RDoc supports multiple markup formats:
92
+
93
+ | Format | File Extensions | Default For |
94
+ |--------|-----------------|-------------|
95
+ | [RDoc](doc/markup_reference/rdoc.rdoc) | `.rdoc` | `.rb`, `.c` files |
96
+ | [Markdown](doc/markup_reference/markdown.md) | `.md` | None |
97
+ | RD | `.rd` | None |
98
+ | TomDoc | N/A | None |
99
+
100
+ **RDoc markup** is currently the default format for Ruby and C files. However, we plan to retire it in favor of Markdown in the future.
101
+
102
+ **Markdown** support is actively being improved. Once it reaches feature parity with RDoc markup, it will become the default format.
103
+
104
+ For standalone documentation files, we recommend writing `.md` files instead of `.rdoc` files.
105
+
106
+ **RD** and **TomDoc** are legacy formats. We highly discourage their use in new projects.
107
+
108
+ ### Specifying Markup Format
109
+
110
+ **Per-file:** Add a `:markup:` directive at the top of a Ruby file:
111
+
112
+ ```ruby
113
+ # :markup: markdown
114
+
115
+ # This class uses **Markdown** for documentation.
116
+ class MyClass
117
+ end
118
+ ```
84
119
 
85
- Comments can contain directives that tell RDoc information that it cannot otherwise discover through parsing. See RDoc::Markup@Directives to control what is or is not documented, to define method arguments or to break up methods in a class by topic. See RDoc::Parser::Ruby for directives used to teach RDoc about metaprogrammed methods.
120
+ **Per-project:** Create a `.rdoc_options` file in your project root:
121
+
122
+ ```yaml
123
+ markup: markdown
124
+ ```
125
+
126
+ **Command line:**
127
+
128
+ ```bash
129
+ rdoc --markup markdown
130
+ ```
131
+
132
+ ### Feature Differences
133
+
134
+ | Feature | RDoc Markup | Markdown |
135
+ |---------|-------------|----------|
136
+ | Headings | `= Heading` | `# Heading` |
137
+ | Bold | `*word*` | `**word**` |
138
+ | Italic | `_word_` | `*word*` |
139
+ | Monospace | `+word+` | `` `word` `` |
140
+ | Links | `{text}[url]` | `[text](url)` |
141
+ | Code blocks | Indent 2 spaces | Fenced with ``` |
142
+ | Cross-references | Automatic | Automatic |
143
+ | Directives (`:nodoc:`, etc.) | Supported | Supported |
144
+ | Tables | Not supported | Supported |
145
+ | Strikethrough | `<del>text</del>` | `~~text~~` |
146
+ | Footnotes | Not supported | Supported |
147
+
148
+ For complete syntax documentation, see:
149
+
150
+ - [RDoc Markup Reference](doc/markup_reference/rdoc.rdoc)
151
+ - [Markdown Reference](doc/markup_reference/markdown.md)
152
+
153
+ ### Directives
154
+
155
+ Comments can contain directives that tell RDoc information that it cannot otherwise discover through parsing. See RDoc::Markup@Directives to control what is or is not documented, to define method arguments or to break up methods in a class by topic. See RDoc::Parser::Ruby for directives used to teach RDoc about metaprogrammed methods.
86
156
 
87
157
  See RDoc::Parser::C for documenting C extensions with RDoc.
88
158
 
89
- To determine how well your project is documented run `rdoc -C lib` to get a documentation coverage report. `rdoc -C1 lib` includes parameter names in the documentation coverage report.
159
+ ### Documentation Coverage
160
+
161
+ To determine how well your project is documented run `rdoc -C lib` to get a documentation coverage report. `rdoc -C1 lib` includes parameter names in the documentation coverage report.
90
162
 
91
163
  ## Theme Options
92
164
 
93
- There are a few community-maintained themes for RDoc:
165
+ RDoc ships with two built-in themes:
166
+
167
+ - **Aliki** (default) - A modern, clean theme with improved navigation and search
168
+ - **Darkfish** (deprecated) - The classic theme, will be removed in v9.0
169
+
170
+ To use the Darkfish theme instead of the default Aliki theme:
171
+
172
+ ```shell
173
+ rdoc --format darkfish
174
+ ```
175
+
176
+ Or in your `.rdoc_options` file:
177
+
178
+ ```yaml
179
+ generator_name: darkfish
180
+ ```
181
+
182
+ There are also a few community-maintained themes for RDoc:
94
183
 
95
184
  - [rorvswild-theme-rdoc](https://github.com/BaseSecrete/rorvswild-theme-rdoc)
96
185
  - [hanna](https://github.com/jeremyevans/hanna) (a fork maintained by [Jeremy Evans](https://github.com/jeremyevans))
97
186
 
98
187
  Please follow the theme's README for usage instructions.
99
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
+
100
224
  ## Bugs
101
225
 
102
- See CONTRIBUTING.rdoc 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.
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.
103
227
 
104
228
  ## License
105
229