[Issue 24871] New: DDoc strips indent in triple slash comments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 22 08:23:26 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24871

          Issue ID: 24871
           Summary: DDoc strips indent in triple slash comments
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: artha at samerion.com

Consider this example file with line comment documentation that contains a code
snippet:

```d
import std.stdio;

/// Example
/// ---
/// void main() {
///     foreach (i; 0..10) {
///             writeln("Hello, world!");
///     }
/// }
/// ---
void main() {

    writeln("Hello, World!");

}
```

When rendered using `dmd -D`, the indent in the snippet is gone:

```d
<pre><code class="code"><span class="keyword">void</span> <span
class="psymbol">main</span>() {
<span class="keyword">foreach</span> (i; 0..10) {
writeln(<span class="string_literal">"Hello, world!"</span>);
}
}
</code></pre>

This is not the case if block comments are used.
```

--


More information about the Digitalmars-d-bugs mailing list