Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it normal that YARD doesn't replace `code` with <code>code</code>?

Tags:

I'm just starting to use YARD for documenting my Rails app. I didn't specify any specific Markup handler, but I would have expected that `code` would be converted to code, which doesn't seem to happen. Is this normal behavior? Do I have to add some additional option to make this work? Thank you.

like image 233
Joshua Muheim Avatar asked Jul 26 '12 08:07

Joshua Muheim


2 Answers

The syntax is a little different from markdown (markdown vs rdoc) I suppose. Using '+' works. +code+ gets rendered in a <code> block.

like image 116
Kashyap Avatar answered Sep 24 '22 05:09

Kashyap


From GitHub, I was used to use backticks for inline code comments. So after some research I found the following, very nice solution.

  • Add the redcarpet gem to your Gemfile
  • Run bundle command
  • Add --markup=markdown to your .yardopts file
  • Start YARD server using yard server --reload
  • Open localhost:8808 in your browser

Now you can use Syntax like on GitHub, e.g.

```ruby def bla; puts 'bla'; end ``` 

Or

`this is inline code` 

Nice! :)

like image 35
Joshua Muheim Avatar answered Sep 24 '22 05:09

Joshua Muheim