Search code examples
rubydocumentationrdocyard

How do I create an arbitrary link in YARD documentation?


I'm trying to create some links in my YARD documentation. I can get an HTTP link:

# I like {http://stackoverflow.com Stackoverflow}

renders as

<p>I like <a href="http://stackoverflow.com">Stackoverflow</a></p>

But an email link:

# You can email the {mailto:[email protected] bugs} list

gives me a warning:

[warn]: In file `':: Cannot resolve link to mailto:bugs@myprojectmailto:[email protected] from text:

and renders as

<p>You can email the <tt>bugs</tt> list</p>

I've tried the regular RDoc syntax for links:

bugs[mailto:[email protected]]

but YARD seems to ignore that. Does anyone know of a more reliable syntax?


Solution

  • Digging into YARD's code shows the problem: in gems/yard-0.2.3.5/lib/yard there is the line (73):

    if name.include?("://")
    

    which doesn't allow mailto links. You can replace this line with

    if name.include?("://") or name.include?("mailto:")
    

    and it will work as you want... not exactly ideal, but that's all I've got right now.