Inline code in the docs - the correct way

Adam D. Ruppe destructionator at gmail.com
Thu Feb 1 01:27:43 UTC 2018


On Wednesday, 31 January 2018 at 15:40:04 UTC, Jakub Łabaj wrote:
> What is the current state of the art of writing inline code in 
> the documentation?

To give you a quick answer, the tide is going toward ``. You 
should probably just use it in most cases as long as the code 
fits on a single line. If it is a multi-line sample, use ddoc's 
`---` brackets or a documented unittest instead.

If you do want cross referencing, don't rely on $(D) nor `` to do 
it. Instead, there's a $(REF) macro in std.ddoc to use. Do NOT 
combine them:

See also: $(REF std,string,lowerCase) // correct (i think)*
See also: `$(REF ...)` // wrong, do not use `` here


* I don't remember the actual syntax for that ref macro.


More information about the Digitalmars-d mailing list