Search code examples
rubytextileredcloth

Using tables with RedCloth inserts a lot of extra <br/> before each table


I am using the tables in RedCloth, for example

|cat|yeah|what|
|beery|true|fly|
|baru|false|mirror|

But I get a lot of <br/> and then the table....

What is going on and how can I fix this?


Solution

  • That table doesn't produce any <br/>s when formatted using the redcloth.org "try it" box on their homepage. However, something like this:

    a
    |cat|yeah|what|
    |beery|true|fly|
    |baru|false|mirror|
    

    produces:

    <p>a<br />
    |cat|yeah|what|<br />
    |beery|true|fly|<br />
    |baru|false|mirror|</p>
    

    So I would guess that you have a paragraph right before the tables without a blank link separating them. Adding an empty line:

    a
    
    |cat|yeah|what|
    |beery|true|fly|
    |baru|false|mirror|
    

    Produces what is probably the desired result:

    <p>a</p>
    <table>
        <tr>
            <td>cat</td>
            <td>yeah</td>
            <td>what</td>
        </tr>
        <tr>
            <td>beery</td>
            <td>true</td>
            <td>fly</td>
        </tr>
        <tr>
            <td>baru</td>
            <td>false</td>
            <td>mirror</td>
        </tr>
    </table>