macros
In this article, you’ll learn more about the rule type macros. See the table below:
Rule | macros |
---|---|
Description | Control which macros can be used by either allow- or block-listing macros. |
Ignore pages with label |
|
Configuration options: | |
To specify a macro in your config options you have to use its internal name. This name can be different to the name shown in the editor. Use this list of internal macro names to do so. | |
allowed | List of macro names that are allowed to be used exclusively. Every macro not in this list will be reported in the quality report. The value of this property can either be a plain string that specifies the macro name or can be a macro + parameters that should be allowed (see examples below). |
blocked | List of macro names that are not allowed to be used. Every macro in this list will be reported in the quality report. If a macro is listed on both the allowed and blocked list it will be blocked. The value of this property can either be a plain string that specifies the macro name or can be a macro + parameters that should be blocked (see examples below). |
Example settings
Allow only admonition macros (Info, Success, Warning, Error)
# All macros except the allowed will be reported as suggestion.
rules:
- rule: macros
level: minor
allowed: [info, tip, note, warning]
Do not allow “Code snippet” macros
# "Code snippet" macros will be reported as warning.
rules:
- rule: macros
level: major
blocked: [code]
Allow only macros with certain parameter values
# "Code snippet" macros will be reported as warning if the "language" parameter is NOT set to "C#".
rules:
- rule: macros
level: major
allowed:
- macro: code
parameters:
language: c#
Block only macros with certain parameter values
# "Code snippet" macros will be reported as warning if the "language" parameter is set to "C#"
rules:
- rule: macros
level: major
blocked:
- macro: code
parameters:
language: c#