Search code examples
rubyrdoc

How to add line break in rdoc


I have a code and comments for RDoc like this:

# first line comment
# second line comment
def foo
end

When I output document by rdoc foo.rb, then line break are ignored in HTML file.

To add line break I can write like:

# first line comment<br>
# second line comment

or

# first line comment
#
# second line comment

but I feel both way are not simple enough.

Is there other simple way to add line break in RDoc?


Solution

  • Just add two or more spaces to the end of the line and it will work.

    #first comment  
    #second comment
    def foo
    end
    

    The first line has 2 spaces after comment.