Skip to content

Commit ed92195

Browse files
add documentation article about doxygen
1 parent 7d3b096 commit ed92195

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

Sources/Markdown/Block Nodes/Block Container Blocks/Doxygen Commands/DoxygenReturns.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import Foundation
1212

13-
/// A parsed Doxygen `\returns` command.
13+
/// A parsed Doxygen `\returns`, `\return`, or `\result` command.
1414
///
1515
/// The Doxygen support in Swift-Markdown parses `\returns` commands of the form
1616
/// `\returns description`, where `description` continues until the next blank line or parsed

Sources/Markdown/Markdown.docc/Markdown/BlockMarkup.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626

2727
## See Also
2828
- <doc:BlockDirectives>
29+
- <doc:DoxygenCommands>
2930

3031
<!-- Copyright (c) 2021-2022 Apple Inc and the Swift Project authors. All Rights Reserved. -->
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Doxygen Commands
2+
3+
Include a limited set of Doxygen commands in parsed Markdown.
4+
5+
Swift Markdown includes an option to parse a limited set of Doxygen commands, to facilitate
6+
transitioning from a different Markdown parser. To include these commands in the output, include
7+
the options ``ParseOptions/parseBlockDirectives`` and ``ParseOptions/parseMinimalDoxygen`` when
8+
parsing a ``Document``. In the resulting document, parsed Doxygen commands appear as regular
9+
``Markup`` types in the hierarchy.
10+
11+
## Parsing Strategy
12+
13+
Doxygen commands are written by using either a backslash (`\`) or an at-sign (`@`) character,
14+
followed by the name of the command. Any parameters are then parsed as whitespace-separated words,
15+
then a "description" argument is taken from the remainder of the line, as well as all lines
16+
immediately after the command, until the parser sees a blank line, another Doxygen command, or a
17+
block directive. The description is then parsed for regular Markdown formatting, which is then
18+
stored as the children of the command type. For example, with Doxygen parsing turned on, the
19+
following document will parse three separate commands and one block directive:
20+
21+
```markdown
22+
\param thing The thing.
23+
This is the thing that is modified.
24+
\param otherThing The other thing.
25+
26+
\returns A thing that has been modified.
27+
@Comment {
28+
This is not part of the `\returns` command.
29+
}
30+
```
31+
32+
Doxygen commands are not parsed within code blocks or block directive content. No indentation
33+
adjustment is performed on paragraph arguments that span multiple lines, unlike with block directive
34+
content.
35+
36+
## Topics
37+
38+
### Commands
39+
40+
- ``DoxygenParam``
41+
- ``DoxygenReturns``
42+
43+
<!-- Copyright (c) 2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->

0 commit comments

Comments
 (0)