Inline code in the docs - the correct way

Adam D. Ruppe destructionator at gmail.com
Sat Feb 3 14:35:03 UTC 2018


On Saturday, 3 February 2018 at 11:44:44 UTC, Seb wrote:
> Have you thought of simply postprocessing REF_ALTTEXT for your 
> documentation engine for now?

It actually supports the macro, so I could just keep the upstream 
source here, just the difference between them is kinda striking.

The history here is there were a lot of broken links in the 
phobos source because they used LINK2 when I forked. I changed 
them to my [reference] syntax and made the point that if it is 
broken for me, it is broken for ddox too, so a macro should be 
introduced to fix it.

After that, the $(REF) and $(REF_ALTTEXT) macros were introduced 
in Phobos.... but I had already changed all the LINK2 in my tree 
to my syntax, so when Phobos changed their LINK2s to REF later 
(it took between months and years for Phobos to catch up to what 
I was able to accomplish in days and weeks!), I added support for 
the Phobos macro too, but the ones I had already changed the 
syntax on caused these merge conflicts.



I pasted it here just because of the kinda striking difference. 
And adrdox actually even supports pseudo-symbol references of 
this type so you could just write [input-range] and it'd look it 
up from a user-supplied glossary (located in the source of 
package.d btw, it is scoped just like a real symbol) to know the 
term and the appropriate link!

But even the long form you see above is just so much nicer than 
the macro one. You don't have to tell the compiler something the 
compiler already knows - which import isInputRange comes from.



More information about the Digitalmars-d mailing list