Open
Description
Input:
//! <details open>
//! <summary>Example 1</summary>
//!
//! ```
#![doc = "test()"]
//! ```
//!
//! </details>
//!
//! <details open>
//! <summary>Example 2</summary>
//!
//! ```
//! example(2);
//! ```
//!
//! </details>
rustfmt +nightly --config format_code_in_doc_comments=true
Outputs:
//! <details open>
//! <summary>Example 1</summary>
//!
//! ```
#![doc = "test()"]
//! ```
//!
//! </details>
//!
//! <details open>
//! <summary>Example 2</summary>
//! ```
//! example(2);
//! ```
//!
//! </details>
Note no empty line before second example. So rustdoc of output looks like this:

Empty lines before backticks are important for Markdown.
HTML blocks in commonmark must end with empty line:
End condition: line is followed by a blank line
rustfmt 1.7.0-nightly (ca663b06 2024-01-08)