yard, How to include image to documentation?
Asked Answered
B

3

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?

Blackness answered 8/5, 2011 at 15:35 Comment(0)
B
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
Bespeak answered 8/5, 2011 at 15:54 Comment(1)
This does work for me(rails 3.1.0, Yard 0.7.2). The text is html escaped: &lt;img src='img/1.png' /&gt;Voluntarism
M
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.

Misstep answered 4/9, 2016 at 3:18 Comment(0)
J
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 /.

Jurisprudence answered 27/4, 2012 at 6:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.