Skip to content

Commit dcf973f

Browse files
Add documentation for no-hidden-lines codeblock attribute
1 parent 09784d6 commit dcf973f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/doc/rustdoc/src/write-documentation/what-to-include.md

+29
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,35 @@ The example is the same on the doc page, but has that extra information
8585
available to anyone trying to use your crate. More about tests in the
8686
upcoming [Documentation tests] chapter.
8787

88+
In case you're writing documentation for a macro, it might be useful to use
89+
the `no-hidden-lines` attribute in order to prevent some `#` characters to be
90+
stripped:
91+
92+
``````rust
93+
//! ```rust,no-hidden-lines
94+
//!
95+
//! test!(
96+
//! #a,
97+
//! ##b,
98+
//! ###c
99+
//! );
100+
//! ```
101+
macro_rules! test {
102+
(#a,##b,###c) => {}
103+
}
104+
``````
105+
106+
Without using the `no-hidden-lines` attribute, the generated code example would
107+
look like this:
108+
109+
```text
110+
test!(
111+
#a,
112+
#b,
113+
##c
114+
);
115+
```
116+
88117
## What to Exclude
89118

90119
Certain parts of your public interface may be included by default in the output

0 commit comments

Comments
 (0)