Inline code in the docs - the correct way

Seb seb at wilzba.ch
Thu Feb 1 10:07:06 UTC 2018


On Thursday, 1 February 2018 at 01:27:43 UTC, Adam D. Ruppe wrote:
> 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.

It's: $(REF lowerCase, std,string) or $(REF_ALTTEXT alternative 
text, lowerCase, std,string)


More information about the Digitalmars-d mailing list