Bug 24871 – DDoc strips indent in triple slash comments

Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-11-22T08:23:26Z
Last change time
2024-11-25T08:35:20Z
Keywords
pull
Assigned to
No Owner
Creator
artha

Comments

Comment #0 by artha — 2024-11-22T08:23:26Z
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. ```
Comment #1 by dlang-bot — 2024-11-22T11:58:02Z
@ArthaTi created dlang/dmd pull request #17082 "Fix bugzilla issue 24871 - DDoc strips indent in triple slash comments" fixing this issue: - Fix bugzilla issue 24871 - DDoc strips indent in triple slash comments Removes code in the lexer responsible for removing leading spaces in triple slash doc comments. This affects the test file for issue 14413; two more spaces appear, but they are not significant in the HTML output. https://github.com/dlang/dmd/pull/17082
Comment #2 by dlang-bot — 2024-11-25T08:35:20Z
dlang/dmd pull request #17082 "Fix bugzilla issue 24871 - DDoc strips indent in triple slash comments" was merged into master: - 303d95f680b6533885f28b6ec1651c0fe4e4a905 by Artha: Fix bugzilla issue 24871 - DDoc strips indent in triple slash comments Removes code in the lexer responsible for removing leading spaces in triple slash doc comments. This affects the test file for issue 14413; two more spaces appear, but they are not significant in the HTML output. https://github.com/dlang/dmd/pull/17082