Alir3z4 / html2text

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

feature/add-optional-kwargs: Added optional kwargs #309

Open 098799 opened 4 years ago

098799 commented 4 years ago

Most of the init arguments in the HTML2Text class are hardcoded in constants and modifiable only by the cli, not through the library usage. This adds the possibility to pass kwargs through the function call html2text or class init.

Please note that the commit contains syntax that is not recognizable by mypy, but is correct. Note: https://github.com/python/mypy/issues/5719

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.05%) to 97.824% when pulling a6d9f9abb6ffc95f79b8727a414825fe64bca670 on RedPointsSolutions:feature/add-optional-kwargs into 2d2c7023e6498611e567fb68727ca4628c187b77 on Alir3z4:master.

Alir3z4 commented 3 years ago

Most of the init arguments in the HTML2Text class are hardcoded in constants and modifiable only by the cli, not through the library usage.

I consider that as a problem, but the approach doesn't look clean to me, regardless of of how mypy works with it, the code has become harder to read, especially when setattr is being used here.

The code would be much easier to read when it's explicit and easily being able to follow.

098799 commented 3 years ago

Hey @Alir3z4, thanks for the reply. If you prefer, I can keep the current structure and replicate the big list once again in the kwargs of __init__. Would you prefer that solution?