rdoc 7.0.3 → 7.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.
- checksums.yaml +4 -4
- data/README.md +70 -4
- data/doc/markup_reference/markdown.md +558 -0
- data/doc/markup_reference/rdoc.rdoc +1169 -0
- data/lib/rdoc/code_object/class_module.rb +24 -3
- data/lib/rdoc/code_object/context/section.rb +20 -1
- data/lib/rdoc/cross_reference.rb +30 -21
- data/lib/rdoc/generator/template/aliki/class.rhtml +3 -1
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +20 -0
- data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +2 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -0
- data/lib/rdoc/markdown.kpeg +1 -5
- data/lib/rdoc/markdown.rb +1 -5
- data/lib/rdoc/markup/attribute_manager.rb +28 -1
- data/lib/rdoc/markup/heading.rb +99 -27
- data/lib/rdoc/markup/to_html.rb +31 -11
- data/lib/rdoc/markup/to_html_crossref.rb +24 -5
- data/lib/rdoc/markup/to_label.rb +11 -1
- data/lib/rdoc/markup/verbatim.rb +1 -1
- data/lib/rdoc/markup.rb +2 -2
- data/lib/rdoc/parser/changelog.rb +8 -0
- data/lib/rdoc/text.rb +15 -0
- data/lib/rdoc/token_stream.rb +4 -8
- data/lib/rdoc/version.rb +1 -1
- data/rdoc.gemspec +2 -2
- metadata +5 -7
- data/ExampleMarkdown.md +0 -39
- data/ExampleRDoc.rdoc +0 -210
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c14913bad669603f9b9662966297c2e33b45af4500c9cd71bbff067da334ee1a
|
|
4
|
+
data.tar.gz: 4e40f1f5b579891945cc7e365bf3977863eb9236eb9af872d870cb46317d191b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3aadc0477ea9dd400c1128c512352745b7835171f998c89a83a2827190a41e171d6fa5b89e5c9a27da0bab76fa5492236f7ce13d59ce64970cd414abd9da806c
|
|
7
|
+
data.tar.gz: a6949c4950b1fd69c8176330e1c6bedb4912281521f31f66d36b123e912d7fe2bf4736cfd0dae22ac8de939badd817bbd771f500bbc65f8041ab7939d43a3e14
|
data/README.md
CHANGED
|
@@ -60,7 +60,7 @@ You can specify the target files for document generation with `.document` file i
|
|
|
60
60
|
|
|
61
61
|
## Writing Documentation
|
|
62
62
|
|
|
63
|
-
To write documentation for RDoc place a comment above the class, module, method, constant, or attribute you want documented:
|
|
63
|
+
To write documentation for RDoc, place a comment above the class, module, method, constant, or attribute you want documented:
|
|
64
64
|
|
|
65
65
|
```rb
|
|
66
66
|
##
|
|
@@ -80,13 +80,79 @@ class Shape
|
|
|
80
80
|
end
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
### Markup Formats
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
RDoc supports multiple markup formats:
|
|
86
|
+
|
|
87
|
+
| Format | File Extensions | Default For |
|
|
88
|
+
|--------|-----------------|-------------|
|
|
89
|
+
| [RDoc](doc/markup_reference/rdoc.rdoc) | `.rdoc` | `.rb`, `.c` files |
|
|
90
|
+
| [Markdown](doc/markup_reference/markdown.md) | `.md` | None |
|
|
91
|
+
| RD | `.rd` | None |
|
|
92
|
+
| TomDoc | N/A | None |
|
|
93
|
+
|
|
94
|
+
**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.
|
|
95
|
+
|
|
96
|
+
**Markdown** support is actively being improved. Once it reaches feature parity with RDoc markup, it will become the default format.
|
|
97
|
+
|
|
98
|
+
For standalone documentation files, we recommend writing `.md` files instead of `.rdoc` files.
|
|
99
|
+
|
|
100
|
+
**RD** and **TomDoc** are legacy formats. We highly discourage their use in new projects.
|
|
101
|
+
|
|
102
|
+
### Specifying Markup Format
|
|
103
|
+
|
|
104
|
+
**Per-file:** Add a `:markup:` directive at the top of a Ruby file:
|
|
105
|
+
|
|
106
|
+
```ruby
|
|
107
|
+
# :markup: markdown
|
|
108
|
+
|
|
109
|
+
# This class uses **Markdown** for documentation.
|
|
110
|
+
class MyClass
|
|
111
|
+
end
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Per-project:** Create a `.rdoc_options` file in your project root:
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
markup: markdown
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Command line:**
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
rdoc --markup markdown
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Feature Differences
|
|
127
|
+
|
|
128
|
+
| Feature | RDoc Markup | Markdown |
|
|
129
|
+
|---------|-------------|----------|
|
|
130
|
+
| Headings | `= Heading` | `# Heading` |
|
|
131
|
+
| Bold | `*word*` | `**word**` |
|
|
132
|
+
| Italic | `_word_` | `*word*` |
|
|
133
|
+
| Monospace | `+word+` | `` `word` `` |
|
|
134
|
+
| Links | `{text}[url]` | `[text](url)` |
|
|
135
|
+
| Code blocks | Indent 2 spaces | Fenced with ``` |
|
|
136
|
+
| Cross-references | Automatic | Automatic |
|
|
137
|
+
| Directives (`:nodoc:`, etc.) | Supported | Supported |
|
|
138
|
+
| Tables | Not supported | Supported |
|
|
139
|
+
| Strikethrough | `<del>text</del>` | `~~text~~` |
|
|
140
|
+
| Footnotes | Not supported | Supported |
|
|
141
|
+
|
|
142
|
+
For complete syntax documentation, see:
|
|
143
|
+
|
|
144
|
+
- [RDoc Markup Reference](doc/markup_reference/rdoc.rdoc)
|
|
145
|
+
- [Markdown Reference](doc/markup_reference/markdown.md)
|
|
146
|
+
|
|
147
|
+
### Directives
|
|
148
|
+
|
|
149
|
+
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
150
|
|
|
87
151
|
See RDoc::Parser::C for documenting C extensions with RDoc.
|
|
88
152
|
|
|
89
|
-
|
|
153
|
+
### Documentation Coverage
|
|
154
|
+
|
|
155
|
+
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
156
|
|
|
91
157
|
## Theme Options
|
|
92
158
|
|
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
# Markdown Reference
|
|
2
|
+
|
|
3
|
+
This document is the comprehensive reference for Markdown support in RDoc.
|
|
4
|
+
It covers all syntax, extensions, and formatting options available.
|
|
5
|
+
|
|
6
|
+
For Ruby-specific features that require actual code (like cross-reference targets
|
|
7
|
+
and directives that only work in Ruby comments), see RDoc::Example.
|
|
8
|
+
|
|
9
|
+
## About the Examples
|
|
10
|
+
|
|
11
|
+
- Examples show Markdown syntax.
|
|
12
|
+
- Rendered output is shown in blockquotes where helpful.
|
|
13
|
+
|
|
14
|
+
## Blocks
|
|
15
|
+
|
|
16
|
+
Markdown documents consist of various block types:
|
|
17
|
+
|
|
18
|
+
- [Paragraphs](#paragraphs): ordinary text blocks.
|
|
19
|
+
- [Headings](#headings): section titles.
|
|
20
|
+
- [Code Blocks](#code-blocks): verbatim text with syntax highlighting.
|
|
21
|
+
- [Blockquotes](#blockquotes): quoted passages.
|
|
22
|
+
- [Lists](#lists): bullet, numbered, and definition lists.
|
|
23
|
+
- [Tables](#tables): tabular data.
|
|
24
|
+
- [Horizontal Rules](#horizontal-rules): visual separators.
|
|
25
|
+
|
|
26
|
+
### Paragraphs
|
|
27
|
+
|
|
28
|
+
A paragraph is one or more consecutive lines of text,
|
|
29
|
+
separated from other blocks by blank lines.
|
|
30
|
+
|
|
31
|
+
Example:
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
This is the first paragraph. It can span
|
|
35
|
+
multiple lines.
|
|
36
|
+
|
|
37
|
+
This is the second paragraph.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Single newlines within a paragraph become spaces in the output.
|
|
41
|
+
|
|
42
|
+
### Headings
|
|
43
|
+
|
|
44
|
+
#### ATX-Style Headings
|
|
45
|
+
|
|
46
|
+
Use `#` characters at the start of a line. Levels 1-6 are supported:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
# Heading Level 1
|
|
50
|
+
## Heading Level 2
|
|
51
|
+
### Heading Level 3
|
|
52
|
+
#### Heading Level 4
|
|
53
|
+
##### Heading Level 5
|
|
54
|
+
###### Heading Level 6
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Optional closing `#` characters are allowed:
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
## Heading ##
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Setext-Style Headings
|
|
64
|
+
|
|
65
|
+
Underline text with `=` for level 1 or `-` for level 2:
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
Heading Level 1
|
|
69
|
+
===============
|
|
70
|
+
|
|
71
|
+
Heading Level 2
|
|
72
|
+
---------------
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Code Blocks
|
|
76
|
+
|
|
77
|
+
#### Indented Code Blocks
|
|
78
|
+
|
|
79
|
+
Indent code by 4 spaces or 1 tab:
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
This is a paragraph.
|
|
83
|
+
|
|
84
|
+
def hello
|
|
85
|
+
puts "world"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
This is another paragraph.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Fenced Code Blocks
|
|
92
|
+
|
|
93
|
+
Use triple backticks with an optional language identifier:
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
def hello
|
|
97
|
+
puts "world"
|
|
98
|
+
end
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Supported language for syntax highlighting: `ruby`, `rb` (alias to `ruby`), and `c`.
|
|
102
|
+
|
|
103
|
+
### Blockquotes
|
|
104
|
+
|
|
105
|
+
Prefix lines with `>`:
|
|
106
|
+
|
|
107
|
+
```markdown
|
|
108
|
+
> This is a blockquote.
|
|
109
|
+
> It can span multiple lines.
|
|
110
|
+
>
|
|
111
|
+
> Multiple paragraphs are supported.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Blockquotes can contain other elements:
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
> ## Heading inside blockquote
|
|
118
|
+
>
|
|
119
|
+
> - List item 1
|
|
120
|
+
> - List item 2
|
|
121
|
+
>
|
|
122
|
+
> Code inside blockquote:
|
|
123
|
+
>
|
|
124
|
+
> def example
|
|
125
|
+
> :ok
|
|
126
|
+
> end
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Nested blockquotes:
|
|
130
|
+
|
|
131
|
+
```markdown
|
|
132
|
+
> Outer quote
|
|
133
|
+
>
|
|
134
|
+
> > Nested quote
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Lists
|
|
138
|
+
|
|
139
|
+
#### Bullet Lists
|
|
140
|
+
|
|
141
|
+
Use `*`, `+`, or `-` followed by a space:
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
* Item 1
|
|
145
|
+
* Item 2
|
|
146
|
+
* Item 3
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Or:
|
|
150
|
+
|
|
151
|
+
```markdown
|
|
152
|
+
- Item 1
|
|
153
|
+
- Item 2
|
|
154
|
+
- Item 3
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### Numbered Lists
|
|
158
|
+
|
|
159
|
+
Use digits followed by `.` and a space:
|
|
160
|
+
|
|
161
|
+
```markdown
|
|
162
|
+
1. First item
|
|
163
|
+
2. Second item
|
|
164
|
+
3. Third item
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The actual numbers don't matter; they're renumbered in output:
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
1. First
|
|
171
|
+
1. Second
|
|
172
|
+
1. Third
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### Nested Lists
|
|
176
|
+
|
|
177
|
+
Indent with 4 spaces to nest:
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
* Item 1
|
|
181
|
+
* Nested item A
|
|
182
|
+
* Nested item B
|
|
183
|
+
* Item 2
|
|
184
|
+
1. Numbered nested
|
|
185
|
+
2. Also numbered
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### Definition Lists
|
|
189
|
+
|
|
190
|
+
Use a term on one line, then `:` followed by the definition:
|
|
191
|
+
|
|
192
|
+
```markdown
|
|
193
|
+
term
|
|
194
|
+
: Definition of the term.
|
|
195
|
+
|
|
196
|
+
cat
|
|
197
|
+
: A small furry mammal.
|
|
198
|
+
|
|
199
|
+
ant
|
|
200
|
+
: A little insect.
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Multiple definitions for one term:
|
|
204
|
+
|
|
205
|
+
```markdown
|
|
206
|
+
apple
|
|
207
|
+
: A fruit
|
|
208
|
+
: A technology company
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Tables
|
|
212
|
+
|
|
213
|
+
Create tables with pipes and dashes:
|
|
214
|
+
|
|
215
|
+
```markdown
|
|
216
|
+
| Column 1 | Column 2 | Column 3 |
|
|
217
|
+
|----------|----------|----------|
|
|
218
|
+
| Cell 1 | Cell 2 | Cell 3 |
|
|
219
|
+
| Cell 4 | Cell 5 | Cell 6 |
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### Column Alignment
|
|
223
|
+
|
|
224
|
+
Use colons to specify alignment:
|
|
225
|
+
|
|
226
|
+
```markdown
|
|
227
|
+
| Left | Center | Right |
|
|
228
|
+
|:---------|:--------:|---------:|
|
|
229
|
+
| Left | Center | Right |
|
|
230
|
+
| aligned | aligned | aligned |
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
- `:---` or `---` for left alignment (default)
|
|
234
|
+
- `:---:` for center alignment
|
|
235
|
+
- `---:` for right alignment
|
|
236
|
+
|
|
237
|
+
Tables support inline formatting in cells:
|
|
238
|
+
|
|
239
|
+
```markdown
|
|
240
|
+
| Feature | Syntax |
|
|
241
|
+
|-------------|-----------------|
|
|
242
|
+
| **Bold** | `**text**` |
|
|
243
|
+
| *Italic* | `*text*` |
|
|
244
|
+
| `Code` | `` `text` `` |
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Horizontal Rules
|
|
248
|
+
|
|
249
|
+
Use three or more `-`, `*`, or `_` on a line by themselves:
|
|
250
|
+
|
|
251
|
+
```markdown
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
* * *
|
|
255
|
+
|
|
256
|
+
___
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Text Markup
|
|
260
|
+
|
|
261
|
+
Inline text can be formatted with various markup:
|
|
262
|
+
|
|
263
|
+
- [Italic](#italic): emphasized text.
|
|
264
|
+
- [Bold](#bold): strong emphasis.
|
|
265
|
+
- [Bold and Italic](#bold-and-italic): combined emphasis.
|
|
266
|
+
- [Strikethrough](#strikethrough): deleted text.
|
|
267
|
+
- [Inline Code](#inline-code): monospace text.
|
|
268
|
+
|
|
269
|
+
### Italic
|
|
270
|
+
|
|
271
|
+
Use single asterisks or underscores:
|
|
272
|
+
|
|
273
|
+
```markdown
|
|
274
|
+
This is *italic* text.
|
|
275
|
+
This is _also italic_ text.
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
> This is *italic* text.
|
|
279
|
+
> This is _also italic_ text.
|
|
280
|
+
|
|
281
|
+
**Note:** Underscores within words are not interpreted as emphasis:
|
|
282
|
+
|
|
283
|
+
```markdown
|
|
284
|
+
foo_bar_baz remains plain text
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Bold
|
|
288
|
+
|
|
289
|
+
Use double asterisks or underscores:
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
This is **bold** text.
|
|
293
|
+
This is __also bold__ text.
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
> This is **bold** text.
|
|
297
|
+
> This is __also bold__ text.
|
|
298
|
+
|
|
299
|
+
### Bold and Italic
|
|
300
|
+
|
|
301
|
+
Use triple asterisks or underscores:
|
|
302
|
+
|
|
303
|
+
```markdown
|
|
304
|
+
This is ***bold and italic*** text.
|
|
305
|
+
This is ___also bold and italic___ text.
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
> This is ***bold and italic*** text.
|
|
309
|
+
> This is ___also bold and italic___ text.
|
|
310
|
+
|
|
311
|
+
### Strikethrough
|
|
312
|
+
|
|
313
|
+
Use double tildes:
|
|
314
|
+
|
|
315
|
+
```markdown
|
|
316
|
+
This is ~~strikethrough~~ text.
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
> This is ~~strikethrough~~ text.
|
|
320
|
+
|
|
321
|
+
### Inline Code
|
|
322
|
+
|
|
323
|
+
Use backticks:
|
|
324
|
+
|
|
325
|
+
```markdown
|
|
326
|
+
Use the `puts` method.
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
> Use the `puts` method.
|
|
330
|
+
|
|
331
|
+
For code containing backticks, use multiple backticks:
|
|
332
|
+
|
|
333
|
+
```markdown
|
|
334
|
+
Use `` `backticks` `` in code.
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
> Use `` `backticks` `` in code.
|
|
338
|
+
|
|
339
|
+
## Links
|
|
340
|
+
|
|
341
|
+
### Inline Links
|
|
342
|
+
|
|
343
|
+
```markdown
|
|
344
|
+
[Link text](https://example.com)
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
> [Link text](https://example.com)
|
|
348
|
+
|
|
349
|
+
With optional title (title is parsed but not used in RDoc output):
|
|
350
|
+
|
|
351
|
+
```markdown
|
|
352
|
+
[Link text](https://example.com "Title")
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Reference Links
|
|
356
|
+
|
|
357
|
+
Define a reference, then use it:
|
|
358
|
+
|
|
359
|
+
```markdown
|
|
360
|
+
[Link text][ref]
|
|
361
|
+
|
|
362
|
+
[ref]: https://example.com
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Implicit reference (link text matches reference):
|
|
366
|
+
|
|
367
|
+
```markdown
|
|
368
|
+
[Example][]
|
|
369
|
+
|
|
370
|
+
[Example]: https://example.com
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Autolinks
|
|
374
|
+
|
|
375
|
+
URLs and emails in angle brackets become links:
|
|
376
|
+
|
|
377
|
+
```markdown
|
|
378
|
+
<https://example.com>
|
|
379
|
+
<user@example.com>
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
> <https://example.com>
|
|
383
|
+
> <user@example.com>
|
|
384
|
+
|
|
385
|
+
### Cross-References
|
|
386
|
+
|
|
387
|
+
Link to RDoc-documented classes, modules, and methods:
|
|
388
|
+
|
|
389
|
+
```markdown
|
|
390
|
+
[RDoc module](rdoc-ref:RDoc)
|
|
391
|
+
[Options class](rdoc-ref:RDoc::Options)
|
|
392
|
+
[document method](rdoc-ref:RDoc::RDoc#document)
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
See [rdoc.rdoc](rdoc.rdoc) for complete cross-reference documentation.
|
|
396
|
+
|
|
397
|
+
## Images
|
|
398
|
+
|
|
399
|
+
Basic image syntax:
|
|
400
|
+
|
|
401
|
+
```markdown
|
|
402
|
+

|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Image as a link:
|
|
406
|
+
|
|
407
|
+
```markdown
|
|
408
|
+
[](https://example.com)
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
## Anchor Links
|
|
412
|
+
|
|
413
|
+
RDoc supports GitHub-style anchor links. You can link to any heading using its
|
|
414
|
+
anchor, which is the heading text converted to lowercase with spaces replaced
|
|
415
|
+
by hyphens and special characters removed.
|
|
416
|
+
|
|
417
|
+
For example:
|
|
418
|
+
|
|
419
|
+
* [Link to Footnotes](#footnotes)
|
|
420
|
+
* [Link to Blockquotes](#blockquotes)
|
|
421
|
+
* [Link to Anchor Links](#anchor-links)
|
|
422
|
+
|
|
423
|
+
## Footnotes
|
|
424
|
+
|
|
425
|
+
### Reference Footnotes
|
|
426
|
+
|
|
427
|
+
Add a footnote reference in text, then define it:
|
|
428
|
+
|
|
429
|
+
```markdown
|
|
430
|
+
Here is some text[^1] with a footnote[^note].
|
|
431
|
+
|
|
432
|
+
[^1]: This is the first footnote.
|
|
433
|
+
[^note]: This is another footnote.
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Inline Footnotes
|
|
437
|
+
|
|
438
|
+
Create footnotes inline:
|
|
439
|
+
|
|
440
|
+
```markdown
|
|
441
|
+
Here is text ^[with an inline footnote].
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
Footnotes are collected and rendered at the bottom of the section,
|
|
445
|
+
separated by a horizontal rule.
|
|
446
|
+
|
|
447
|
+
## HTML
|
|
448
|
+
|
|
449
|
+
### Block HTML
|
|
450
|
+
|
|
451
|
+
Raw HTML blocks are preserved:
|
|
452
|
+
|
|
453
|
+
```markdown
|
|
454
|
+
<div class="note">
|
|
455
|
+
<p>This is HTML content.</p>
|
|
456
|
+
</div>
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Supported block-level tags include: `<address>`, `<blockquote>`, `<div>`,
|
|
460
|
+
`<fieldset>`, `<form>`, `<h1>`-`<h6>`, `<ol>`, `<p>`, `<pre>`, `<table>`, `<ul>`.
|
|
461
|
+
|
|
462
|
+
### Inline HTML
|
|
463
|
+
|
|
464
|
+
Inline HTML is also preserved:
|
|
465
|
+
|
|
466
|
+
```markdown
|
|
467
|
+
This has <b>bold</b> and <em>emphasized</em> HTML.
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
## Special Characters
|
|
471
|
+
|
|
472
|
+
### Escaping
|
|
473
|
+
|
|
474
|
+
Use backslash to escape special characters:
|
|
475
|
+
|
|
476
|
+
```markdown
|
|
477
|
+
\*not italic\*
|
|
478
|
+
\`not code\`
|
|
479
|
+
\[not a link\]
|
|
480
|
+
\# not a heading
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
Escapable characters: `` ` \ : | * _ { } [ ] ( ) # + . ! > < - ``
|
|
484
|
+
|
|
485
|
+
### HTML Entities
|
|
486
|
+
|
|
487
|
+
Named, decimal, and hexadecimal entities are supported:
|
|
488
|
+
|
|
489
|
+
```markdown
|
|
490
|
+
© — π
|
|
491
|
+
A A
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
## Line Breaks
|
|
495
|
+
|
|
496
|
+
End a line with two or more spaces for a hard line break:
|
|
497
|
+
|
|
498
|
+
```markdown
|
|
499
|
+
Line one
|
|
500
|
+
Line two
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
## Directives
|
|
504
|
+
|
|
505
|
+
RDoc directives work in Markdown files within Ruby comments.
|
|
506
|
+
Use the `:markup: markdown` directive to specify Markdown format.
|
|
507
|
+
|
|
508
|
+
```ruby
|
|
509
|
+
# :markup: markdown
|
|
510
|
+
|
|
511
|
+
# This class uses **Markdown** for documentation.
|
|
512
|
+
#
|
|
513
|
+
# ## Features
|
|
514
|
+
#
|
|
515
|
+
# - Bold with `**text**`
|
|
516
|
+
# - Italic with `*text*`
|
|
517
|
+
class MyClass
|
|
518
|
+
end
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
Common directives (same as RDoc markup):
|
|
522
|
+
|
|
523
|
+
- `:nodoc:` - Suppress documentation
|
|
524
|
+
- `:doc:` - Force documentation
|
|
525
|
+
- `:stopdoc:` / `:startdoc:` - Start/stop documentation parsing
|
|
526
|
+
- `:call-seq:` - Custom calling sequence
|
|
527
|
+
- `:section:` - Create documentation sections
|
|
528
|
+
|
|
529
|
+
See [rdoc.rdoc](rdoc.rdoc) for complete directive documentation.
|
|
530
|
+
|
|
531
|
+
## Comparison with RDoc Markup
|
|
532
|
+
|
|
533
|
+
| Feature | RDoc Markup | Markdown |
|
|
534
|
+
|---------|-------------|----------|
|
|
535
|
+
| Headings | `= Heading` | `# Heading` |
|
|
536
|
+
| Bold | `*word*` | `**word**` |
|
|
537
|
+
| Italic | `_word_` | `*word*` |
|
|
538
|
+
| Monospace | `+word+` | `` `word` `` |
|
|
539
|
+
| Links | `{text}[url]` | `[text](url)` |
|
|
540
|
+
| Code blocks | Indent beyond margin | Indent 4 spaces or fence |
|
|
541
|
+
| Block quotes | `>>>` | `>` |
|
|
542
|
+
| Tables | Not supported | Supported |
|
|
543
|
+
| Strikethrough | `<del>text</del>` | `~~text~~` |
|
|
544
|
+
| Footnotes | Not supported | `[^1]` |
|
|
545
|
+
|
|
546
|
+
## Notes and Limitations
|
|
547
|
+
|
|
548
|
+
1. **Link titles are parsed but not used** - The title in `[text](url "title")` is ignored.
|
|
549
|
+
|
|
550
|
+
2. **Underscores in words** - `foo_bar` is never italicized; emphasis requires whitespace boundaries.
|
|
551
|
+
|
|
552
|
+
3. **Footnotes are collapsed** - Multiple paragraphs in a footnote become a single paragraph.
|
|
553
|
+
|
|
554
|
+
4. **Syntax highlighting** - Only `ruby` and `c` are supported for fenced code blocks.
|
|
555
|
+
|
|
556
|
+
5. **Fenced code blocks** - Only triple backticks are supported. Tilde fences (`~~~`) are not supported as they conflict with strikethrough syntax. Four or more backticks for nesting are also not supported.
|
|
557
|
+
|
|
558
|
+
6. **Auto-linking** - RDoc automatically links class and method names in output, even without explicit link syntax.
|