Question

Assume that I have the follow class.

class Foo

  # I want the following to appear as-is in my documentation, not as an anchor tag. 
  #
  # http://www.google.com/
  #
  def bar
    puts "bar"
  end
end

And then I run it through rdoc.

$ rdoc foo.rb

It generates this:

<div class="method-description">
  <p>
    I want the following to appear as-is in my documentation, not as an anchor tag.
  </p>
  <p>
    <a href="http://www.google.com">www.google.com</a>/
  </p>
</div>

I want it to generate something like this instead:

<div class="method-description">
  <p>
    I want the following to appear as-is in my documentation, not as an anchor tag.
  </p>
  <p>
    http://www.google.com/
  </p>
</div>

What would be the best way to accomplish this?

Was it helpful?

Solution

Step 1

Make sure that you're using:

ruby 1.9.2
rdoc 2.5.8

Step 2

Escape it and you should be fine.

class Foo

  # I want the following to appear as-is in my documentation, not as an anchor tag. 
  #
  # \http://www.google.com/
  #
  def bar
    puts "bar"
  end
end

Output:

<div class="method-description"> 
  <p>
    I want the following to appear as-is in my documentation, not as an anchor tag.
  </p>  
  <p>
    http://www.google.com/
  </p>
</div>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top