|
7 | 7 | # attributes, and constants -- are solely for illustrating \RDoc markup, |
8 | 8 | # and have no other legitimate use. |
9 | 9 | # |
10 | | -# = \RDoc Markup Reference |
11 | | -# |
12 | | -# Notes: |
| 10 | +# == About the Examples |
13 | 11 | # |
14 | 12 | # - Examples in this reference are Ruby code and comments; |
15 | 13 | # certain differences from other sources |
16 | 14 | # (such as C code and comments) are noted. |
| 15 | +# - Almost all examples on this page are all RDoc-like; |
| 16 | +# that is, they have no explicit comment markers like Ruby <tt>#</tt> |
| 17 | +# or C <tt>/* ... */</tt>. |
17 | 18 | # - An example that shows rendered HTML output |
18 | 19 | # displays that output in a blockquote: |
19 | 20 | # |
20 | | -# Rendered HTML: |
21 | 21 | # >>> |
22 | 22 | # Some stuff |
23 | 23 | # |
24 | | -# \RDoc-generated documentation is derived from and controlled by: |
25 | | -# |
26 | | -# - Single-line or multi-line comments that precede certain definitions; |
27 | | -# see {Markup in Comments}[rdoc-ref:RDoc::MarkupReference@Markup+in+Comments]. |
28 | | -# - \RDoc directives in trailing comments (on the same line as code); |
29 | | -# see <tt>:nodoc:</tt>, <tt>:doc:</tt>, and <tt>:notnew:</tt>. |
30 | | -# - \RDoc directives in single-line comments; |
31 | | -# see other {Directives}[rdoc-ref:RDoc::MarkupReference@Directives]. |
32 | | -# - The Ruby code itself (but not from C code); |
33 | | -# see {Documentation Derived from Ruby Code}[rdoc-ref:RDoc::MarkupReference@Documentation+Derived+from+Ruby+Code]. |
34 | | -# |
35 | | -# == Markup in Comments |
36 | | -# |
37 | | -# The treatment of markup in comments varies according to the type of file: |
| 24 | +# == \RDoc Sources |
38 | 25 | # |
39 | | -# - <tt>.rb</tt> (Ruby code file): markup is parsed from Ruby comments. |
40 | | -# - <tt>.c</tt> (C code file): markup is parsed from C comments. |
41 | | -# - <tt>.rdoc</tt> (RDoc text file): markup is parsed from the entire file. |
42 | | -# |
43 | | -# The comment associated with |
44 | | -# a Ruby class, module, method, alias, constant, or attribute |
45 | | -# becomes the documentation for that defined object: |
46 | | -# |
47 | | -# - In a Ruby file, that comment immediately precedes |
48 | | -# the definition of the object. |
49 | | -# - In a C file, that comment immediately precedes |
50 | | -# the function that implements a method, |
51 | | -# or otherwise immediately precedes the definition of the object. |
| 26 | +# The sources of \RDoc documentation vary according to the type of file: |
52 | 27 | # |
53 | | -# In either a Ruby or a C file, |
54 | | -# \RDoc ignores comments that do not precede object definitions. |
| 28 | +# - <tt>.rb</tt> (Ruby code file): |
55 | 29 | # |
56 | | -# In an \RDoc file, the text is not associated with any code object, |
57 | | -# but may (depending on how the documentation is built), |
58 | | -# become a separate page. |
| 30 | +# - Markup may be found in Ruby comments: |
| 31 | +# A comment that immediately precedes the definition |
| 32 | +# of a Ruby class, module, method, alias, constant, or attribute |
| 33 | +# becomes the documentation for that defined object. |
| 34 | +# - An \RDoc directive may be found in: |
59 | 35 | # |
60 | | -# Almost all examples on this page are all RDoc-like; |
61 | | -# that is, they have no comment markers like Ruby <tt>#</tt> |
62 | | -# or C <tt>/* ... */</tt>. |
| 36 | +# - A trailing comment (on the same line as code); |
| 37 | +# see <tt>:nodoc:</tt>, <tt>:doc:</tt>, and <tt>:notnew:</tt>. |
| 38 | +# - A single-line comment; |
| 39 | +# see other {Directives}[rdoc-ref:RDoc::MarkupReference@Directives]. |
63 | 40 | # |
64 | | -# === Margins |
| 41 | +# - Documentation may be derived from the Ruby code itself; |
| 42 | +# see {Documentation Derived from Ruby Code}[rdoc-ref:RDoc::MarkupReference@Documentation+Derived+from+Ruby+Code]. |
65 | 43 | # |
66 | | -# In a multi-line comment, |
67 | | -# \RDoc looks for the comment's natural left margin, |
68 | | -# which becomes the <em>base margin</em> for the comment |
69 | | -# and is the initial <em>current margin</em> for the comment. |
70 | | -# |
71 | | -# The current margin can change, and does so, for example in a list. |
| 44 | +# - <tt>.c</tt> (C code file): markup is parsed from C comments. |
| 45 | +# A comment that immediately precedes |
| 46 | +# a function that implements a Ruby method, |
| 47 | +# or otherwise immediately precedes the definition of a Ruby object, |
| 48 | +# becomes the documentation for that object. |
| 49 | +# - <tt>.rdoc</tt> (\RDoc markup text file) or <tt>.md</tt> (\RDoc markdown text file): |
| 50 | +# markup is parsed from the entire file. |
| 51 | +# The text is not associated with any code object, |
| 52 | +# but may (depending on how the documentation is built) |
| 53 | +# become a separate page. |
| 54 | +# |
| 55 | +# An <i>RDoc document</i>: |
| 56 | +# |
| 57 | +# - A (possibly multi-line) comment in a Ruby or C file |
| 58 | +# that generates \RDoc documentation (as above). |
| 59 | +# - The entire markup (<tt>.rdoc</tt>) file or markdown (<tt>.md</tt>) file |
| 60 | +# (which is usually multi-line). |
72 | 61 | # |
73 | 62 | # === Blocks |
74 | 63 | # |
75 | | -# It's convenient to think of \RDoc markup input as a sequence of _blocks_ |
| 64 | +# It's convenient to think of an \RDoc document as a sequence of _blocks_ |
76 | 65 | # of various types (details at the links): |
77 | 66 | # |
78 | 67 | # - {Paragraph}[rdoc-ref:RDoc::MarkupReference@Paragraphs]: |
|
88 | 77 | # - {List}[rdoc-ref:RDoc::MarkupReference@Lists]: items for |
89 | 78 | # a bullet list, numbered list, lettered list, or labeled list. |
90 | 79 | # - {Heading}[rdoc-ref:RDoc::MarkupReference@Headings]: |
91 | | -# a section heading. |
| 80 | +# a heading. |
92 | 81 | # - {Horizontal rule}[rdoc-ref:RDoc::MarkupReference@Horizontal+Rules]: |
93 | 82 | # a line across the rendered page. |
94 | 83 | # - {Directive}[rdoc-ref:RDoc::MarkupReference@Directives]: |
|
103 | 92 | # - Any block may appear independently |
104 | 93 | # (that is, not nested in another block); |
105 | 94 | # some blocks may be nested, as detailed below. |
| 95 | +# - In a multi-line block, |
| 96 | +# \RDoc looks for the block's natural left margin, |
| 97 | +# which becomes the <em>base margin</em> for the block |
| 98 | +# and is the initial <em>current margin</em> for the block. |
106 | 99 | # |
107 | 100 | # ==== Paragraphs |
108 | 101 | # |
|
0 commit comments