You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/config-file.adoc
+84-99
Original file line number
Diff line number
Diff line change
@@ -49,156 +49,141 @@ These definitions are included in all targets of the compilation database.
49
49
50
50
== Filters
51
51
52
-
=== Symbol Filters
53
-
54
52
Not all symbols in a project may be relevant to the documentation.
55
-
MrDocs provides a way to filter out symbols based on their names.
53
+
MrDocs provides a way to filter out symbols based on their location and names.
56
54
57
-
[,yaml]
58
-
----
59
-
filters:
60
-
symbols: # <.>
61
-
exclude: # <.>
62
-
include: # <.>
63
-
----
55
+
=== File Filters
64
56
65
-
<.> Optional `symbols` key
66
-
<.> Optional `exclude` key
67
-
<.> Optional `include` key
57
+
Symbols can also be filtered based on the files where they are declared. This can be useful for excluding files that exclusively contain implementation details or test code.
68
58
69
-
Symbol filter patterns are specified using (optionally) qualified names, and may contain wildcards:
59
+
The `input` option is a list of directories to include and a list of file patterns to include. Only symbols in files from these directories will be extracted.
70
60
71
61
[,yaml]
72
62
----
73
-
filters:
74
-
symbols:
75
-
exclude:
76
-
- 'A::B'
77
-
- 'A::f*'
63
+
input:
64
+
- ../include
78
65
----
79
66
80
-
If a symbol matches a pattern in the exclude list, that symbol and its members will not be extracted:
67
+
The default value for `input` is `"<source-root>/."`, so only symbols defined in your project source directory will be extracted.
68
+
69
+
The `file-patterns` options allows you to specify a list of glob file patterns to include. Only symbols in files whose filename match these patterns will be extracted.
81
70
82
71
[,yaml]
83
72
----
84
-
filters:
85
-
symbols:
86
-
exclude:
87
-
- 'A'
73
+
file-patterns:
74
+
- '*.hpp'
75
+
- '*.h'
88
76
----
89
77
90
-
[,cpp]
91
-
----
92
-
// ok, does not match any excluded pattern
93
-
void f0();
78
+
The default value for `file-patterns` include a variety of common C++ header file extensions.
94
79
95
-
namespace A // matches the pattern 'A', will not be extracted
96
-
{
97
-
// enclosing namespace matches an excluded pattern:
98
-
// the symbol will not be extracted
99
-
void f1();
100
-
}
101
-
----
102
-
103
-
The `filters.symbols.include` key can be used to override the exclude list for specific symbols.
104
-
A symbol which matches an included pattern and an excluded pattern will be extracted.
105
-
106
-
This permits fine-grained control of extraction for individual members of a class or namespace:
80
+
The `exclude` option is a list of subdirectories in `input` we want to exclude. Meanwhile, `exclude-patterns` can use glob patterns to exclude files from the extraction process.
107
81
108
82
[,yaml]
109
83
----
110
-
filters:
111
-
symbols:
112
-
exclude:
113
-
- 'A'
114
-
include:
115
-
- 'A::g*'
116
-
----
117
-
118
-
[,cpp]
119
-
----
120
-
namespace A
121
-
{
122
-
// enclosing namespace matches an excluded pattern, will not be extracted
123
-
void f0();
124
-
125
-
// ok, matches the pattern 'A::g*' which overrides the exclude list
126
-
void g0();
127
-
}
84
+
input:
85
+
- ../include
86
+
exclude:
87
+
- ../include/detail
88
+
exclude-patterns:
89
+
- ../include/*/detail/**
90
+
- ../include/*/impl/**
128
91
----
129
92
130
-
In order for a filter pattern to match a symbol, it must consist of simple identifiers that match the name as written in its declaration: namespace aliases, typedef-names, and `decltype` specifiers naming the symbol cannot be used.
93
+
The glob patterns support the following wildcards:
131
94
132
-
NOTE: Specifying include patterns is only useful when the pattern would match a subset of symbols matched by an exclude pattern.
133
-
An include pattern without a subsuming exclude pattern will be ignored.
95
+
* `*` matches all characters except delimiters `/`
96
+
* `**` matches all characters
97
+
* `?` matches any single character.
98
+
* `[<chars>]` matches one character in the bracket.
99
+
* `[<char>-<char>]` matches one character in the bracket range.
100
+
* `[^<chars>]` or `[!<chars>]` matches one character not in the bracket.
101
+
* `{<glob>,...}` matches one of the globs in the list.
102
+
* `\` escapes the next character so it is treated as a literal.
134
103
135
-
=== File Filters
104
+
=== Symbol Filters
136
105
137
-
Symbols can also be filtered based on the files they are declared in.
138
-
This can be useful for excluding files that exclusively contain implementation details or test code.
106
+
Symbols can also be filtered based on their qualified names. You can use glob patterns to specify which symbols to include or exclude.
139
107
140
108
[,yaml]
141
109
----
142
-
input:
143
-
include:
144
-
- ../include # <.>
145
-
file-patterns:
146
-
- *.hpp # <.>
110
+
include-symbols:
111
+
- 'my_library::public_namespace::*'
147
112
----
148
113
149
-
<.> A list of directories to include.
150
-
Only symbols defined in these files will be extracted.
151
-
<.> A list of file patterns to include.
152
-
Only symbols defined in files matching these patterns will be extracted.
114
+
By default, all symbols are included by `include-symbols`. The syntax for symbol glob patterns is the same as for file patterns, with the exception that the delimiter `::` is used instead of `/`. So you can match all symbols in a namespace and its subnamespaces with `my_library::public_namespace::**`.
153
115
154
-
=== Private Symbols
155
-
156
-
The `implementation-detail` and `see-below` options can be used to designate namespaces as implementation detail namespaces.
116
+
The option `exclude-symbols` can be used to exclude symbols from the extraction process.
157
117
158
118
[,yaml]
159
119
----
160
-
implementation-detail: 'impl'
161
-
see-below: 'see_below'
120
+
include-symbols:
121
+
- 'my_library::**'
122
+
exclude-symbols:
123
+
- 'my_library::private_namespace::**'
162
124
----
163
125
164
-
If a namespace is designated as an implementation detail namespace, all symbols within that namespace will be marked as implementation details in the documentation.
165
-
166
126
[,cpp]
167
127
----
168
-
namespace impl
128
+
// excluded by `include-symbols`
129
+
void f0();
130
+
131
+
// included because it matches the prefix of 'my_library::**' in `include-symbols`
132
+
namespace my_library
169
133
{
170
-
class A {};
171
-
}
134
+
// included because it matches the pattern 'my_library::**' in `include-symbols`
135
+
void f1();
172
136
173
-
/// @brief A foo function
174
-
A foo();
137
+
namespace private_namespace
138
+
{
139
+
// excluded by the pattern 'my_library::private_namespace::**' in `exclude-symbols`
140
+
void f2();
141
+
}
142
+
}
175
143
----
176
144
177
-
The `impl` namespace is designated as an implementation detail namespace, so all symbols within it will be marked as implementation details in the documentation.
178
-
This means the symbol `A` would not be documented and the function `foo` could be documented as follows:
145
+
=== Private Symbols
146
+
147
+
The `implementation-detail` and `see-below` options can be used to designate symbols as implementation details or "see below" in the documentation.
179
148
180
-
[,cpp]
149
+
[,yaml]
181
150
----
182
-
/* implementation detail */ foo();
151
+
include-symbols:
152
+
- 'my_library::**'
153
+
implementation-detail:
154
+
- 'my_library::detail::**'
155
+
see-below:
156
+
- 'my_library::see_below::**'
183
157
----
184
158
185
-
On the other hand, if a namespace is designated as a `see_below` namespace, all symbols within that namespace will be marked as "see below" in the documentation.
159
+
Symbols are only checked against the `implementation-detail` and `see-below` options if they match the `include-symbols` option.
186
160
187
161
[,cpp]
188
162
----
189
-
namespace see_below
163
+
namespace my_library
190
164
{
191
-
class B {};
165
+
namespace detail
166
+
{
167
+
// There's no documentation page for A
168
+
// Any reference to `A` is rendered as `/* implementation detail */`
169
+
class A {};
170
+
}
171
+
172
+
namespace see_below
173
+
{
174
+
// The documentation page for B is marked as "see below" and its members are not extracted.
175
+
class B {
176
+
// There's no documentation page for iterator
177
+
class iterator;
178
+
};
179
+
}
180
+
181
+
// This function is documented, but the return type is rendered as `/* implementation detail */`
182
+
detail::A
183
+
foo();
192
184
}
193
185
----
194
186
195
-
In the documentation, the symbol `B` would be marked as "see-below" and could be documented as:
0 commit comments