jarontai / html2md

A library for converting HTML to Markdown in Dart. It supports CommonMark, simple table and custom converting rules. 将html转换为markdown的Dart库,支持CommonMark、简单表格以及自定义转换规则。
https://pub.dev/packages/html2md
BSD 2-Clause "Simplified" License
57 stars 25 forks source link

Tables are not being converted properly #14

Closed ThinkDigitalSoftware closed 4 years ago

ThinkDigitalSoftware commented 4 years ago

This is slightly complex, but I've narrowed it down to this package. I'm using this lib to convert html to markdown and then render it in Flutter. The original Markdown source is here. https://github.com/flutterchina/dio/blob/master/README.md for comparison. This is the actual HTML page that's being passed to html2md https://pub.dev/packages/dio You can see the table in the screenshot

Screen Shot 2019-11-13 at 10 39 00 AM

But when it's rendered, it shows like this. Simulator Screen Shot - iPhone 11 Pro Max - 2019-11-13 at 10 36 09

To make a long story short, the table should be rendered like this, https://github.com/flutterchina/dio/blob/master/README.md

Copy of markdown rendered by html2md

jarontai commented 4 years ago

Thank you for the report! This problem should caused by the wrong replacement of thead and tbody.

jarontai commented 4 years ago

Version 0.5.1 published. I add a test for your table source and fix the thead/tbody problem.

ThinkDigitalSoftware commented 4 years ago

That was quick, thank you!

On Thu, Nov 14, 2019, 7:27 AM Jaron Tai notifications@github.com wrote:

Version 0.5.1 published. I add a test for your table source and fix the thead/tbody problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jarontai/html2md/issues/14?email_source=notifications&email_token=AFPYO7MT4DULFPGUPP5LFFDQTVU5JA5CNFSM4JM75LHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEECGXKA#issuecomment-553937832, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFPYO7PWCCW5FPSWILTYCW3QTVU5JANCNFSM4JM75LHA .