aaronsw / html2text

Convert HTML to Markdown-formatted text.
http://www.aaronsw.com/2002/html2text/
GNU General Public License v3.0
2.57k stars 410 forks source link

markdown link was truncated because the limit of BODY_WIDTH 78 #131

Open Yuelioi opened 1 year ago

Yuelioi commented 1 year ago

today, i try it to convert html to md,but img url is not right

in the __init__.py , optwrap function

# line 918
wrapped = wrap(
  para,
  self.body_width,
  break_long_words=False,
  subsequent_indent=indent,
)

this will limit url to 78, maybe we change it to ( like this ? ):

if (para.startswith("![]")):
  wrapped = wrap(
      para,
      999,
      break_long_words=False,
      subsequent_indent=indent,
  )
else:
  wrapped = wrap(
      para,
      self.body_width,
      break_long_words=False,
      subsequent_indent=indent,
  )