Skip to content

Commit 095b781

Browse files
[DOC] MarkupReference (#1075)
1 parent 914a6af commit 095b781

File tree

2 files changed

+42
-48
lines changed

2 files changed

+42
-48
lines changed

.document

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ LICENSE.txt
33
README.txt
44
RI.txt
55
lib
6+
doc

doc/rdoc/markup_reference.rb

+41-48
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,61 @@
77
# attributes, and constants -- are solely for illustrating \RDoc markup,
88
# and have no other legitimate use.
99
#
10-
# = \RDoc Markup Reference
11-
#
12-
# Notes:
10+
# == About the Examples
1311
#
1412
# - Examples in this reference are Ruby code and comments;
1513
# certain differences from other sources
1614
# (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>.
1718
# - An example that shows rendered HTML output
1819
# displays that output in a blockquote:
1920
#
20-
# Rendered HTML:
2121
# >>>
2222
# Some stuff
2323
#
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
3825
#
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:
5227
#
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):
5529
#
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:
5935
#
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].
6340
#
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].
6543
#
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).
7261
#
7362
# === Blocks
7463
#
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_
7665
# of various types (details at the links):
7766
#
7867
# - {Paragraph}[rdoc-ref:RDoc::MarkupReference@Paragraphs]:
@@ -88,7 +77,7 @@
8877
# - {List}[rdoc-ref:RDoc::MarkupReference@Lists]: items for
8978
# a bullet list, numbered list, lettered list, or labeled list.
9079
# - {Heading}[rdoc-ref:RDoc::MarkupReference@Headings]:
91-
# a section heading.
80+
# a heading.
9281
# - {Horizontal rule}[rdoc-ref:RDoc::MarkupReference@Horizontal+Rules]:
9382
# a line across the rendered page.
9483
# - {Directive}[rdoc-ref:RDoc::MarkupReference@Directives]:
@@ -103,6 +92,10 @@
10392
# - Any block may appear independently
10493
# (that is, not nested in another block);
10594
# 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.
10699
#
107100
# ==== Paragraphs
108101
#

0 commit comments

Comments
 (0)