Skip to content

Commit 2308312

Browse files
authored
Migrate README to markdown (#1422)
1 parent 1e4573b commit 2308312

File tree

9 files changed

+141
-174
lines changed

9 files changed

+141
-174
lines changed

.rdoc_options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
op_dir: _site # for GitHub Pages and should match the config of RDoc task in Rakefile
22
title: rdoc Documentation
3-
main_page: README.rdoc
3+
main_page: README.md
44
autolink_excluded_words:
55
- RDoc

README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# RDoc - Ruby Documentation System
2+
3+
- GitHub: [https://github.com/ruby/rdoc](https://github.com/ruby/rdoc)
4+
- Issues: [https://github.com/ruby/rdoc/issues](https://github.com/ruby/rdoc/issues)
5+
6+
## Description
7+
8+
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.
9+
10+
## Generating Documentation
11+
12+
Once installed, you can create documentation using the `rdoc` command
13+
14+
```shell
15+
rdoc [options] [names...]
16+
```
17+
18+
For an up-to-date option summary, type
19+
20+
```shell
21+
rdoc --help
22+
```
23+
24+
A typical use might be to generate documentation for a package of Ruby source (such as RDoc itself).
25+
26+
```shell
27+
rdoc
28+
```
29+
30+
This command generates documentation for all the Ruby and C source files in and below the current directory. These will be stored in a documentation tree starting in the subdirectory `doc`.
31+
32+
You can make this slightly more useful for your readers by having the index page contain the documentation for the primary file. In our case, we could type
33+
34+
```shell
35+
rdoc --main README.md
36+
```
37+
38+
You'll find information on the various formatting tricks you can use in comment blocks in the documentation this generates.
39+
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.
41+
42+
To generate documentation using `rake` see [RDoc::Task](https://ruby.github.io/rdoc/RDoc/Task.html).
43+
44+
To generate documentation programmatically:
45+
46+
```rb
47+
require 'rdoc/rdoc'
48+
49+
options = RDoc::Options.new
50+
options.files = ['a.rb', 'b.rb']
51+
options.setup_generator 'darkfish'
52+
# see RDoc::Options
53+
54+
rdoc = RDoc::RDoc.new
55+
rdoc.document options
56+
# see RDoc::RDoc
57+
```
58+
59+
You can specify the target files for document generation with `.document` file in the project root directory. `.document` file contains a list of file and directory names including comment lines starting with `#`. See [https://github.com/ruby/rdoc/blob/master/.document](https://github.com/ruby/rdoc/blob/master/.document) as an example.
60+
61+
## Writing Documentation
62+
63+
To write documentation for RDoc place a comment above the class, module, method, constant, or attribute you want documented:
64+
65+
```rb
66+
##
67+
# This class represents an arbitrary shape by a series of points.
68+
class Shape
69+
##
70+
# Creates a new shape described by a +polyline+.
71+
#
72+
# If the +polyline+ does not end at the same point it started at the
73+
# first pointed is copied and placed at the end of the line.
74+
#
75+
# An ArgumentError is raised if the line crosses itself, but shapes may
76+
# be concave.
77+
def initialize polyline
78+
# ...
79+
end
80+
end
81+
```
82+
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.
84+
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.
86+
87+
See RDoc::Parser::C for documenting C extensions with RDoc.
88+
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.
90+
91+
## Theme Options
92+
93+
There are a few community-maintained themes for RDoc:
94+
95+
- [rorvswild-theme-rdoc](https://github.com/BaseSecrete/rorvswild-theme-rdoc)
96+
- [hanna](https://github.com/jeremyevans/hanna) (a fork maintained by [Jeremy Evans](https://github.com/jeremyevans))
97+
98+
Please follow the theme's README for usage instructions.
99+
100+
## Bugs
101+
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.
103+
104+
## License
105+
106+
RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers. Portions (c) 2007-2011 Eric Hodel. Portions copyright others, see individual files and LEGAL.rdoc for details.
107+
108+
RDoc is free software, and may be redistributed under the terms specified in LICENSE.rdoc.
109+
110+
## Warranty
111+
112+
This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.

README.rdoc

Lines changed: 0 additions & 144 deletions
This file was deleted.

doc/rdoc/markup_reference.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@
10071007
# generates baz[rdoc-ref:RDoc::MarkupReference#dummy_attribute].
10081008
# - Alias: <tt>bad[rdoc-ref:RDoc::MarkupReference#dummy_instance_alias]</tt>
10091009
# generates bad[rdoc-ref:RDoc::MarkupReference#dummy_instance_alias].
1010-
# - File: <tt>README[rdoc-ref:README.rdoc]</tt> generates README[rdoc-ref:README.rdoc].
1010+
# - File: <tt>README[rdoc-ref:README.md]</tt> generates README[rdoc-ref:README.md].
10111011
#
10121012
# If the referenced item does not exist, no link is generated
10131013
# and entire <tt>rdoc-ref:</tt> square-bracketed clause is removed
@@ -1050,7 +1050,7 @@
10501050
#
10511051
# [<tt>link:</tt> Scheme]
10521052
#
1053-
# - <tt>link:README_rdoc.html</tt> links to link:README_rdoc.html.
1053+
# - <tt>link:README_md.html</tt> links to link:README_md.html.
10541054
#
10551055
# [<tt>rdoc-image</tt> Scheme]
10561056
#

lib/rdoc/ri/task.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
# require 'rdoc/ri/task'
2727
#
2828
# RDoc::RI::Task.new do |ri|
29-
# ri.main = 'README.rdoc'
30-
# ri.rdoc_files.include 'README.rdoc', 'lib/**/*.rb'
29+
# ri.main = 'README.md'
30+
# ri.rdoc_files.include 'README.md', 'lib/**/*.rb'
3131
# end
3232
#
3333
# For further configuration details see RDoc::Task.

lib/rdoc/task.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
# require 'rdoc/task'
5959
#
6060
# RDoc::Task.new do |rdoc|
61-
# rdoc.main = "README.rdoc"
62-
# rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
61+
# rdoc.main = "README.md"
62+
# rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
6363
# end
6464
#
6565
# The +rdoc+ object passed to the block is an RDoc::Task object. See the
@@ -74,8 +74,8 @@
7474
# require 'rdoc/task'
7575
#
7676
# RDoc::Task.new :rdoc_dev do |rdoc|
77-
# rdoc.main = "README.rdoc"
78-
# rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
77+
# rdoc.main = "README.md"
78+
# rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
7979
# rdoc.options << "--all"
8080
# end
8181
#

rdoc.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
4545
"History.rdoc",
4646
"LEGAL.rdoc",
4747
"LICENSE.rdoc",
48-
"README.rdoc",
48+
"README.md",
4949
"RI.md",
5050
"TODO.rdoc",
5151
"exe/rdoc",
@@ -60,7 +60,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
6060

6161
s.files = (non_lib_files + template_files + lib_files).uniq
6262

63-
s.rdoc_options = ["--main", "README.rdoc"]
63+
s.rdoc_options = ["--main", "README.md"]
6464
s.extra_rdoc_files += s.files.grep(%r[\A[^\/]+\.(?:rdoc|md)\z])
6565

6666
s.required_ruby_version = Gem::Requirement.new(">= 2.6.0")

0 commit comments

Comments
 (0)