|
97 | 97 | #
|
98 | 98 | # = \RDoc Markup Reference
|
99 | 99 | #
|
100 |
| -# == Block Markup |
101 |
| -# |
102 |
| -# === Paragraphs and Verbatim |
103 |
| -# |
104 |
| -# The markup engine looks for a document's natural left margin. This is |
105 |
| -# used as the initial margin for the document. |
106 |
| -# |
107 |
| -# Consecutive lines starting at this margin are considered to be a |
108 |
| -# paragraph. Empty lines separate paragraphs. |
109 |
| -# |
110 |
| -# Any line that starts to the right of the current margin is treated |
111 |
| -# as verbatim text. This is useful for code listings: |
112 |
| -# |
113 |
| -# 3.times { puts "Ruby" } |
114 |
| -# |
115 |
| -# In verbatim text, two or more blank lines are collapsed into one, |
116 |
| -# and trailing blank lines are removed: |
117 |
| -# |
118 |
| -# This is the first line |
119 |
| -# |
120 |
| -# |
121 |
| -# This is the second non-blank line, |
122 |
| -# after 2 blank lines in the source markup. |
123 |
| -# |
124 |
| -# |
125 |
| -# There were two trailing blank lines right above this paragraph, that |
126 |
| -# have been removed. In addition, the verbatim text has been shifted |
127 |
| -# left, so the amount of indentation of verbatim text is unimportant. |
128 |
| -# |
129 |
| -# For HTML output RDoc makes a small effort to determine if a verbatim section |
130 |
| -# contains Ruby source code. If so, the verbatim block will be marked up as |
131 |
| -# HTML. Triggers include "def", "class", "module", "require", the "hash |
132 |
| -# rocket"# (=>) or a block call with a parameter. |
133 |
| -# |
134 |
| -# === Headers |
135 |
| -# |
136 |
| -# A line starting with an equal sign (=) is treated as a |
137 |
| -# heading. Level one headings have one equals sign, level two headings |
138 |
| -# have two, and so on until level six, which is the maximum |
139 |
| -# (seven hyphens or more result in a level six heading). |
140 |
| -# |
141 |
| -# For example, the above header was obtained with: |
142 |
| -# |
143 |
| -# === Headers |
144 |
| -# |
145 |
| -# In HTML output headers have an id matching their name. The above example's |
146 |
| -# HTML is: |
147 |
| -# |
148 |
| -# <h3 id="label-Headers">Headers</h3> |
149 |
| -# |
150 |
| -# If a heading is inside a method body the id will be prefixed with the |
151 |
| -# method's id. If the above header where in the documentation for a method |
152 |
| -# such as: |
153 |
| -# |
154 |
| -# ## |
155 |
| -# # This method does fun things |
156 |
| -# # |
157 |
| -# # = Example |
158 |
| -# # |
159 |
| -# # Example of fun things goes here ... |
160 |
| -# |
161 |
| -# def do_fun_things |
162 |
| -# end |
163 |
| -# |
164 |
| -# The header's id would be: |
165 |
| -# |
166 |
| -# <h1 id="method-i-do_fun_things-label-Example">Example</h1> |
167 |
| -# |
168 |
| -# The label can be linked-to using <tt>SomeClass@Headers</tt>. See |
169 |
| -# {Links}[rdoc-ref:RDoc::Markup@Links] for further details. |
170 |
| -# |
171 |
| -# === Rules |
172 |
| -# |
173 |
| -# A line starting with three or more hyphens (at the current indent) |
174 |
| -# generates a horizontal rule. |
175 |
| -# |
176 |
| -# --- |
177 |
| -# |
178 |
| -# produces: |
179 |
| -# |
180 |
| -# --- |
181 |
| -# |
182 |
| -# === Simple Lists |
183 |
| -# |
184 |
| -# If a paragraph starts with a "*", "-", "<digit>." or "<letter>.", |
185 |
| -# then it is taken to be the start of a list. The margin is increased to be |
186 |
| -# the first non-space following the list start flag. Subsequent lines |
187 |
| -# should be indented to this new margin until the list ends. For example: |
188 |
| -# |
189 |
| -# * this is a list with three paragraphs in |
190 |
| -# the first item. This is the first paragraph. |
191 |
| -# |
192 |
| -# And this is the second paragraph. |
193 |
| -# |
194 |
| -# 1. This is an indented, numbered list. |
195 |
| -# 2. This is the second item in that list |
196 |
| -# |
197 |
| -# This is the third conventional paragraph in the |
198 |
| -# first list item. |
199 |
| -# |
200 |
| -# * This is the second item in the original list |
201 |
| -# |
202 |
| -# produces: |
203 |
| -# |
204 |
| -# * this is a list with three paragraphs in |
205 |
| -# the first item. This is the first paragraph. |
206 |
| -# |
207 |
| -# And this is the second paragraph. |
208 |
| -# |
209 |
| -# 1. This is an indented, numbered list. |
210 |
| -# 2. This is the second item in that list |
211 |
| -# |
212 |
| -# This is the third conventional paragraph in the |
213 |
| -# first list item. |
214 |
| -# |
215 |
| -# * This is the second item in the original list |
216 |
| -# |
217 |
| -# === Labeled Lists |
218 |
| -# |
219 |
| -# You can also construct labeled lists, sometimes called description |
220 |
| -# or definition lists. Do this by putting the label in square brackets |
221 |
| -# and indenting the list body: |
222 |
| -# |
223 |
| -# [cat] a small furry mammal |
224 |
| -# that seems to sleep a lot |
225 |
| -# |
226 |
| -# [ant] a little insect that is known |
227 |
| -# to enjoy picnics |
228 |
| -# |
229 |
| -# produces: |
230 |
| -# |
231 |
| -# [cat] a small furry mammal |
232 |
| -# that seems to sleep a lot |
233 |
| -# |
234 |
| -# [ant] a little insect that is known |
235 |
| -# to enjoy picnics |
236 |
| -# |
237 |
| -# If you want the list bodies to line up to the left of the labels, |
238 |
| -# use two colons: |
239 |
| -# |
240 |
| -# cat:: a small furry mammal |
241 |
| -# that seems to sleep a lot |
242 |
| -# |
243 |
| -# ant:: a little insect that is known |
244 |
| -# to enjoy picnics |
245 |
| -# |
246 |
| -# produces: |
247 |
| -# |
248 |
| -# cat:: a small furry mammal |
249 |
| -# that seems to sleep a lot |
250 |
| -# |
251 |
| -# ant:: a little insect that is known |
252 |
| -# to enjoy picnics |
253 |
| -# |
254 |
| -# Notice that blank lines right after the label are ignored in labeled lists: |
255 |
| -# |
256 |
| -# [one] |
257 |
| -# |
258 |
| -# definition 1 |
259 |
| -# |
260 |
| -# [two] |
261 |
| -# |
262 |
| -# definition 2 |
263 |
| -# |
264 |
| -# produces the same output as |
265 |
| -# |
266 |
| -# [one] definition 1 |
267 |
| -# [two] definition 2 |
268 |
| -# |
269 |
| -# |
270 |
| -# === Lists and Verbatim |
271 |
| -# |
272 |
| -# If you want to introduce a verbatim section right after a list, it has to be |
273 |
| -# less indented than the list item bodies, but more indented than the list |
274 |
| -# label, letter, digit or bullet. For instance: |
275 |
| -# |
276 |
| -# * point 1 |
277 |
| -# |
278 |
| -# * point 2, first paragraph |
279 |
| -# |
280 |
| -# point 2, second paragraph |
281 |
| -# verbatim text inside point 2 |
282 |
| -# point 2, third paragraph |
283 |
| -# verbatim text outside of the list (the list is therefore closed) |
284 |
| -# regular paragraph after the list |
285 |
| -# |
286 |
| -# produces: |
287 |
| -# |
288 |
| -# * point 1 |
289 |
| -# |
290 |
| -# * point 2, first paragraph |
291 |
| -# |
292 |
| -# point 2, second paragraph |
293 |
| -# verbatim text inside point 2 |
294 |
| -# point 2, third paragraph |
295 |
| -# verbatim text outside of the list (the list is therefore closed) |
296 |
| -# regular paragraph after the list |
297 |
| -# |
298 |
| -# == Text Markup |
299 |
| -# |
300 |
| -# === Bold, Italic, Typewriter Text |
301 |
| -# |
302 |
| -# You can use markup within text (except verbatim) to change the |
303 |
| -# appearance of parts of that text. Out of the box, RDoc::Markup |
304 |
| -# supports word-based and general markup. |
305 |
| -# |
306 |
| -# Word-based markup uses flag characters around individual words: |
307 |
| -# |
308 |
| -# <tt>\*_word_\*</tt>:: displays _word_ in a *bold* font |
309 |
| -# <tt>\__word_\_</tt>:: displays _word_ in an _emphasized_ font |
310 |
| -# <tt>\+_word_\+</tt>:: displays _word_ in a +code+ font |
311 |
| -# |
312 |
| -# General markup affects text between a start delimiter and an end |
313 |
| -# delimiter. Not surprisingly, these delimiters look like HTML markup. |
314 |
| -# |
315 |
| -# <tt>\<b>_text_</b></tt>:: displays _text_ in a *bold* font |
316 |
| -# <tt>\<em>_text_</em></tt>:: displays _text_ in an _emphasized_ font |
317 |
| -# (alternate tag: <tt>\<i></tt>) |
318 |
| -# <tt>\<tt>_text_\</tt></tt>:: displays _text_ in a +code+ font |
319 |
| -# (alternate tag: <tt>\<code></tt>) |
320 |
| -# |
321 |
| -# Unlike conventional Wiki markup, general markup can cross line |
322 |
| -# boundaries. You can turn off the interpretation of markup by |
323 |
| -# preceding the first character with a backslash (see <i>Escaping |
324 |
| -# Text Markup</i>, below). |
325 |
| -# |
326 |
| -# === Links |
327 |
| -# |
328 |
| -# Links to starting with +http:+, +https:+, +mailto:+, +ftp:+ or +www.+ |
329 |
| -# are recognized. An HTTP url that references an external image is converted |
330 |
| -# into an inline image element. |
331 |
| -# |
332 |
| -# Classes and methods will be automatically linked to their definition. For |
333 |
| -# example, <tt>RDoc::Markup</tt> will link to this documentation. By default |
334 |
| -# methods will only be automatically linked if they contain an <tt>_</tt> (all |
335 |
| -# methods can be automatically linked through the <tt>--hyperlink-all</tt> |
336 |
| -# command line option). |
337 |
| -# |
338 |
| -# Single-word methods can be linked by using the <tt>#</tt> character for |
339 |
| -# instance methods or <tt>::</tt> for class methods. For example, |
340 |
| -# <tt>#convert</tt> links to #convert. A class or method may be combined like |
341 |
| -# <tt>RDoc::Markup#convert</tt>. |
342 |
| -# |
343 |
| -# A heading inside the documentation can be linked by following the class |
344 |
| -# or method by an <tt>@</tt> then the heading name. |
345 |
| -# <tt>RDoc::Markup@Links</tt> will link to this section like this: |
346 |
| -# RDoc::Markup@Links. Spaces in headings with multiple words must be escaped |
347 |
| -# with <tt>+</tt> like <tt>RDoc::Markup@Escaping+Text+Markup</tt>. |
348 |
| -# Punctuation and other special characters must be escaped like CGI.escape. |
349 |
| -# |
350 |
| -# The <tt>@</tt> can also be used to link to sections. If a section and a |
351 |
| -# heading share the same name the section is preferred for the link. |
352 |
| -# |
353 |
| -# Links can also be of the form <tt>label[url]</tt>, in which case +label+ is |
354 |
| -# used in the displayed text, and +url+ is used as the target. If +label+ |
355 |
| -# contains multiple words, put it in braces: <tt>{multi word label}[url]</tt>. |
356 |
| -# The +url+ may be an +http:+-type link or a cross-reference to a class, |
357 |
| -# module or method with a label. |
358 |
| -# |
359 |
| -# Links with the <code>rdoc-image:</code> scheme will create an image tag for |
360 |
| -# HTML output. Only fully-qualified URLs are supported. |
361 |
| -# |
362 |
| -# Links with the <tt>rdoc-ref:</tt> scheme will link to the referenced class, |
363 |
| -# module, method, file, etc. If the referenced item is does not exist |
364 |
| -# no link will be generated and <tt>rdoc-ref:</tt> will be removed from the |
365 |
| -# resulting text. |
366 |
| -# |
367 |
| -# Links starting with <tt>rdoc-label:label_name</tt> will link to the |
368 |
| -# +label_name+. You can create a label for the current link (for |
369 |
| -# bidirectional links) by supplying a name for the current link like |
370 |
| -# <tt>rdoc-label:label-other:label-mine</tt>. |
371 |
| -# |
372 |
| -# Links starting with +link:+ refer to local files whose path is relative to |
373 |
| -# the <tt>--op</tt> directory. Use <tt>rdoc-ref:</tt> instead of |
374 |
| -# <tt>link:</tt> to link to files generated by RDoc as the link target may |
375 |
| -# be different across RDoc generators. |
376 |
| -# |
377 |
| -# Example links: |
378 |
| -# |
379 |
| -# https://github.com/ruby/rdoc |
380 |
| -# mailto:user@example.com |
381 |
| -# {RDoc Documentation}[http://rdoc.rubyforge.org] |
382 |
| -# {RDoc Markup}[rdoc-ref:RDoc::Markup] |
| 100 | +# See RDoc::MarkupReference. |
383 | 101 | #
|
384 | 102 | # === Escaping Text Markup
|
385 | 103 | #
|
|
0 commit comments