xijo / reverse_markdown

Ruby gem to convert html into markdown
Do What The F*ck You Want To Public License
629 stars 118 forks source link

Support for <colgroup> and <col> #33

Closed pkuczynski closed 10 years ago

pkuczynski commented 10 years ago

Add support for <colgroup> and <col> which could be simply ignored...

http://www.w3schools.com/tags/tag_colgroup.asp

xijo commented 10 years ago

Thanks for reporting, will be released in a view days.

pkuczynski commented 10 years ago

Actually in my case I had a following table definition:

<table>
    <colgroup>
        <col />
        <col />
    </colgroup>
    <tbody>
        <tr>
            <td>...</td>
            <td>...</td>
        </tr>
        ...
    </tbody>
</table>

So after turning option to pass through unknow tags, the table was converted correctly, however it was missing the header. So when converting it back to htm using Redcarpet did not worked.

If a table is missing a header I would still expect the table to be rendered. This could be achieved by generating empty header:

|   |   |
|---|---|
| ... | ... |
| ... | ... |

What do you think?

xijo commented 10 years ago

Ok so this is more about the tbody and thead element. Hm! Ok, I'll put that into the next release as well, stay tuned!

pkuczynski commented 10 years ago

Well, one thing was that with default settings it was skipping the table, which was a very bad thing from my point of view. I could fix that by adding the pass_through option to unknow_tags. However this was not generating a header at all, so gems like Redcarpet could not convert it back to a table...

Maybe there should be another issue raised in this case if you prefer?

xijo commented 10 years ago

Nah, that's fine. You're completely right, it shouldn't have skipped the table, the support for those tags was just missing.

Now the table should be included and even if it misses the thead in the end the output should be fairly correct.

Please let me know if this works for you!

pkuczynski commented 10 years ago

Have you release a new version?

xijo commented 10 years ago

0.6.0 will be release within the next hour. Thanks for reporting again. :+1: