Skip to content

Commit 558a2c3

Browse files
committed
add explanation for rustfmt::skip::macros
1 parent f493a59 commit 558a2c3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,19 @@ needs to be specified in `rustfmt.toml`, e.g., with `edition = "2018"`.
205205
| coverage | displays how much of the input file was processed | Yes |
206206
| checkstyle | emits in a checkstyle format | Yes |
207207

208+
* For things you do not want rustfmt to mangle for some macro,
209+
use `#[rustfmt::skip::macros(target_macro_name)]`
210+
211+
Example:
212+
213+
```rust
214+
#[rustfmt::skip::macros(html)]
215+
fn main() {
216+
let macro_result1 = html! { <div>
217+
Hello</div>
218+
}.to_string();
219+
```
220+
208221
## License
209222

210223
Rustfmt is distributed under the terms of both the MIT license and the

0 commit comments

Comments
 (0)