| title | RDoc |
|---|---|
| category | Markup |
| intro | Quick reference for RDoc markup and directives. For YARD tags such as `@param`, see the YARD cheatsheet. |
Basic comment
{: .-prime}
# Adds two numbers. # # Returns the sum. def add(left, right) left + right end
RDoc associates a comment with the Ruby object immediately below it.
Inline markup
*bold*
_emphasized_
+code+
Links and references
https://www.example.com/
RDoc::Markup
RDoc::Markup#convert
{Ruby documentation}[https://docs.ruby-lang.org/]
Structure
Headings
= Page title
== Section
=== Subsection
Lists
* First item
* Second item
1. First step
2. Second step
Definition lists
name:: description
+option+:: option description
[name] description
[other] another description
Directives
Hide documentation
def internal_method # :nodoc: end module InternalNamespace # :nodoc: all end
# :stopdoc: def hidden_method end # :startdoc:
Calling sequence
# :call-seq: # readlines(sep = $/) -> array # readlines(limit) -> array # readlines(sep, limit) -> array
Use :call-seq: when the generated signature needs to show multiple forms or a return value.
Arguments and yields
# :args: source, destination = nil # :yields: value
These directives override the arguments or yielded values reported by RDoc.
Category
# :category: Utilities # # Escapes HTML characters. def escape_html(text) end
:category: applies only to the next documented item.
Section
# :section: Expiry methods # Methods for expiring records. # Expires the record. def expire! end
:section: remains active until another section directive changes it.
Markup format
# :markup: TomDocPlace the directive at the beginning of the file to select a supported input format.
Also see
{: .-one-column}