Thread overview
Suggestion: __traits(ddoc)
May 11, 2021
James Lu
May 11, 2021
Adam D. Ruppe
May 11, 2021
Vladimir Panteleev
May 11, 2021

DDoC is very convenient for generating HTML documentation.

Sometimes, though, we need to print documentation back, for example when writing a command line tool and "-h" is passed.

I suggest __traits(ddoc, symbol), which would return the concatenated DDoC source of a symbol as an enum string.

If DMD compiler authors provide pointers (where to start, what methods to call) on how to do this, I will implement this myself and send a pull request.

May 11, 2021

On Tuesday, 11 May 2021 at 00:00:30 UTC, James Lu wrote:

>

I suggest __traits(ddoc, symbol), which would return the concatenated DDoC source of a symbol as an enum string.

omg yes this would be SO useful for me.

May 11, 2021

On Tuesday, 11 May 2021 at 00:00:30 UTC, James Lu wrote:

>

I suggest __traits(ddoc, symbol), which would return the concatenated DDoC source of a symbol as an enum string.

This has been proposed and implemented before, but it was not accepted into the language. See:

>

DDoC is very convenient for generating HTML documentation.

Sometimes, though, we need to print documentation back, for example when writing a command line tool and "-h" is passed.

This is the same use case I had:

https://github.com/dlang/dmd/pull/6872#issuecomment-307109065