My project has a README.template.md file which should not be parsed by YARD.
I've used --exclude for certain .rb files, but I can't seem to exclude this file.
$ yard doc --exclude README.template.md
[warn]: In file `README.template.md':2: Cannot resolve link to { from text:
...{{ ossHeader }...
[warn]: In file `README.template.md':2: Cannot resolve link to { from text:
...{{ ossHeader }...
[warn]: In file `README.template.md':2: Cannot resolve link to { from text:
...{{ ossHeader }...
[warn]: In file `README.template.md':2: Cannot resolve link to { from text:
...{{ ossHeader }...
I've tried marking it private by adding @private at the top, YARD still parses it.
<!--
# @private
-->
{{ ossHeader }}
## Getting Started :running:
How can I get YARD to ignore this file?
$ yard config
ivars:
:@symbolize_value: false
elements:
:load_plugins: false
:ignored_plugins: []
:autoload_plugins: []
:safe_mode: false
$ cat .yardopts
--no-private
--exclude _pb.rb$
TLDR; Your only choice is to rename the README.template.md to something else :(
Why Yard does Yard things
This has been a fun deep dive back into ruby. I read through the Yardoc source, specifically the command line parser and found this.
From Yarddoc Source starting at line 287. Let's look at the relevant parts of the "parse_arguments" function
The code shows it will always glob any file that starts with the letters 'README' no matter what follows. This is the default behavior, and the maintainer has no intention of changing it as of today. No judgement, I agree with the philosophy.
Solutions
I see a couple of options for you.
Yard provides before and after procs for the YarddocTask
Now this isn't the BEST way to solve the problem. You really shouldn't be shelling out because of... lots of reasons... but it is a working solution. I also am assuming a *nix environment when renaming the file. You should probably change it to use ruby FileUtils.
Let me know if you need a deeper explanation. I'll be happy to expand on anything you are unclear on.