Skip to content

Commit 678b724

Browse files
committed
docs: commands page include examples
1 parent 6e1ee8a commit 678b724

File tree

1 file changed

+92
-7
lines changed

1 file changed

+92
-7
lines changed

docs/modules/ROOT/pages/commands.adoc

+92-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,99 @@
11
= Commands
22

3-
These are the Doxygen-style "@" commands recognized by MrDocs:
3+
The code should be documented with the https://docs.oracle.com/en/java/javase/13/docs/specs/javadoc/doc-comment-spec.html[Doc Comment,window=_blank] format, also informally known as "javadoc" format or Doxygen-style comments.
44
5-
== Italics / Emphasis
6-
[]
5+
In its most basic form, these are usually comment blocks between `pass:[/**]` and `pass:[*/]` placed above a class, function, or field declaration:
6+
7+
[source,c++]
8+
----
9+
/** The main information about a person
10+
11+
This class represents a person with
12+
a name and an age. This is the
13+
information about a person that
14+
we need to store in our system.
15+
*/
16+
struct person
17+
{
18+
std::string name;
19+
int age;
20+
}
21+
22+
/** A function to greet a person
23+
24+
This function takes a person and
25+
prints a greeting message.
26+
27+
@param p The person to greet
28+
*/
29+
void greet(person const& p);
730
----
8-
@a [word]
9-
@e [word]
10-
@em [word]
1131
12-
<em>[text]</em>
32+
A common alternative is to use `pass:[///]`, especially for single-line comments:
33+
34+
[source,c++]
35+
----
36+
/// A constant representing the number of hours in a day
37+
static constexpr int hours_in_day = 24;
1338
----
1439
40+
Both the class and the function above have doc comments with a brief sentence and a detailed description.
41+
Most doc comments will contain these two sections, which could also be explicitly marked with `@brief` and `@details` commands.
42+
43+
Doc comments can also contain a number of special commands such as `@param` that are used to document the parameters of a function.
44+
45+
== Style
46+
47+
The following commands can be used to format the text in the doc comments:
48+
49+
|===
50+
| Command | Description
51+
| `@a` | Formats the text in italics
52+
| `@e` | Formats the text in italics
53+
| `@em` | Formats the text in italics
54+
| `@b` | Formats the text in bold
55+
| `@strong` | Formats the text in bold
56+
|
57+
|===
58+
59+
// == Documentation at other places
60+
// @class, @struct, @union, @enum, @fn, @var, @def, @typedef, @file, @namespace...
61+
62+
// == Lists
63+
// - <ul><li><ol> / @arg / @li / # / 1.2.3... / [ ] / [x]
64+
65+
// == Grouping
66+
// === Topics
67+
// @defgroup / @addtogroup / @ingroup / @weakgroup
68+
// === Member groups
69+
// @name
70+
// === Subpaging
71+
// @page / @mainpage
72+
73+
// == Formulas
74+
// @f
75+
76+
// == Tables
77+
// <table><tr><th><td> / Markdown format
78+
79+
// == Graphs
80+
// @callgraph, @hidecallgraph, @callergraph, @hidecallergraph
81+
82+
// == Link generation
83+
// === Webpages
84+
// <a href=""></a>
85+
// === Symbols
86+
// @ref / any string with at least one non-lower case character
87+
// === Files
88+
// @ref / any string containing '.'
89+
// === Functions
90+
// <functionName>"("<argument-list>")"
91+
// <functionName>"()"
92+
// "::"<functionName>
93+
// (<className>"::")n<functionName>"("<argument-list>")"
94+
// (<className>"::")n<functionName>"("<argument-list>")"<modifiers>
95+
// (<className>"::")n<functionName>"()"
96+
// (<className>"::")n<functionName>
97+
// === Links to external documentation
98+
// Tagfiles + @ref
99+

0 commit comments

Comments
 (0)