Skip to content

Commit

Permalink
Add documentation for no-hidden-lines codeblock attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 10, 2023
1 parent 2ba9f45 commit c989304
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/doc/rustdoc/src/write-documentation/what-to-include.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,34 @@ The example is the same on the doc page, but has that extra information
available to anyone trying to use your crate. More about tests in the
upcoming [Documentation tests] chapter.

In case you're writing documentation for a macro, it might be useful to use
the `no-hidden-lines` attribute in order to prevent some `#` characters to be
stripped:

``````rust
//! ```rust,no-hidden-lines
//!
//! test!(
//! # a,
//! ##b,
//! ###c
//! );
//! ```
macro_rules! test {
(# a,##b,###c) => {}
}
``````

Without using the `no-hidden-lines` attribute, the generated code example would
look like this:

```text
test!(
#b,
##c
);
```

## What to Exclude

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

0 comments on commit c989304

Please sign in to comment.