I've a gem that I've produced with some docs written with Github Flavoured markdown (GFM) to take advantage of their syntax highlighting.
Unfortunately, Github decided to use their own syntax for code block fencing (three backticks) so to get Yardoc to parse that correctly I've chosen Kramdown as the parser, which supports GFM.
On top of that, when I push the code up to Rubygems the documentation will be generated by running the Rake task (as far as I understand). So I need to find a way to tell Yard to use the Kramdown GFM parser, via Rake.
Kramdown selects the parser via the -i
switch:
$ bin/kramdown --help
Command line options:
-i, --input ARG
Specify the input format: kramdown (default), html, GFM or markdown
But I don't know how to get Yard to pass that, either via the yard
binary or through Rake. I suppose this could be possible by creating a Yardoc plugin, but I've never done that and not sure if it would work, and it also seems like things would be getting out of hand at that point!
What I'd really like is a markdown standard for this, but that's not so much a question as an unfulfilled desire… I'm not sure Stack Overflow can help with those so much.
I recently ran across this issue and was having trouble finding clear guidance anywhere, so after digging around in Yard’s issues and source I came up with this approach and am pretty happy with it. Hopefully it might be helpful to someone else who comes across this thread.
Add a Ruby file for Yard customizations. If you have additional docs in a
docs/
folder, thendocs/yard_support.rb
might be a good place. In it, add a custom markup provider for Yard.Use
--load <path_to_the_above_file>
in your.yardopts
file: