Search code examples
rubyyardyardoc

YARD generates wrong references to files


I use YARD to generate a doc for ruby project. This project includes a README.md file and looks like below:

# MyTool

<p align="center">
    <img src="static/logo/mytool.png">
</p>

Welcome to your new gem!

...

## Copyright

Copyright (C) 2019 Company. See [License](LICENSE.txt) for further details.

The doc generated by YARD includes this readme file, but it has a litte problem. The paths to the files static/logo/mytool.png and LICENSE.txt are wrong. The generated index.html points to doc/static/logo/mytool.png and doc/LICENSE.txt, so the link is broken when I click on it.

I tried to move these files to doc folder, but YARD generates references like this doc/doc/static/logo/mytool.png. Note double doc in reference.

I'm newbe wih YARD and ruby. What is the best practice to handle this problem? Can YARD copy this files to doc folder?


Solution

  • Check out the --asset option, via yard help doc or here. Given your example above, this should do the trick:

    yard doc --asset static --asset LICENSE.txt