7

I want to include image in yard-genereted documentation, but can't find anywhere how to do this... Does anyone know how to do this?

Vasiliy Ermolovich
  • 24,459
  • 5
  • 79
  • 77
Adrian Serafin
  • 7,665
  • 5
  • 46
  • 67

3 Answers3

2

You can just add <img /> tag to your documentation:

 # Blah-blah 
 # 
 # <img src=img/1.png />
 # @param [String] blah
 # @return [String] blah
 def foo(bar) 

 end
Vasiliy Ermolovich
  • 24,459
  • 5
  • 79
  • 77
  • 4
    This does work for me(rails 3.1.0, Yard 0.7.2). The text is html escaped: `<img src='img/1.png' />` – Dorian Oct 20 '11 at 09:38
1

Use rdoc-image: links:

# Gets foo.
#
# rdoc-image:img/1.png
def foo(bar)
  "foo"
end

is rendered by YARD into

<p>Gets foo.</p>
<p><img src="img/1.png"></p>

The rdoc-images: also works in standalone *.rdoc files.

Franklin Yu
  • 8,920
  • 6
  • 43
  • 57
0

Depending on your markup format you may have to use another mechanism. For instance, if you use Markdown, the syntax is ![Alt text](/path/to/img.jpg). In RDoc, an img tag should work, but you can check if they have added a special markup syntax for this. Note that RDoc probably (not sure) doesn't like XHTML, you should use with no ending /.

Loren Segal
  • 3,251
  • 1
  • 28
  • 29