Alir3z4 / html2text

Convert HTML to Markdown-formatted text.
alir3z4.github.io/html2text/
GNU General Public License v3.0
1.8k stars 273 forks source link

Unusual line break inside link when converting table #202

Open randomnoob opened 6 years ago

randomnoob commented 6 years ago

I got some unusual line breaks inside links when converting tables

Input

raw = """<td align="center" width="211">
      <img alt="Algerian chorba with bird tongues 4" class="alignnone size-thumbnail wp-image-48225" height="150" src="https://www.amourdecuisine.fr/wp-content/uploads/2016/06/chorba-alg%C3%A9rienne-aux-langues-doiseaux-4-150x150.jpg" width="150"/>
      <a href="https://www.amourdecuisine.fr/article-chorba-algerienne-aux-langues-doiseaux.html" target="_blank">
       <strong>
        chorba bird languages
       </strong>
      </a>
     </td>"""

Output with line breaks in hyperlink

'![Algerian chorba with bird tongues 4](https://www.amourdecuisine.fr/wp-\ncontent/uploads/2016/06/chorba-alg%C3%A9rienne-aux-langues-\ndoiseaux-4-150x150.jpg) [ **chorba bird languages**\n](https://www.amourdecuisine.fr/article-chorba-algerienne-aux-langues-\ndoiseaux.html)\n\n'

html2text 2018.1.9 Python 3.6

otsab19 commented 6 years ago

Is this solved?

macropin commented 5 years ago

I'm seeing this as well. The markdown tables are not rendered correctly.

PowersYang commented 4 years ago

you could solve it by setting the value of text_maker.body_width, eg:text_maker.body_width = 2000