Skip to content

inline tags within strong/strike/u/i/em/... do not handle spaces correctly #371

Open
@mrh1997

Description

@mrh1997

Some inline tags require removing space between text and markdown (<strong>TEXT </string> => **TEXT**)

When adding another inline tag within these tags space removal does not work proper any more:

from html2text import html2text
print(html2text("<b><a>X</a></b>")))   # returns "**X**" => OK
print(html2text("<b>X </b>")))         # returns "**X**" => OK
print(html2text("<b><a>X</a> </b>")))  # returns "**X **" => INVALID  (expected "**X**")
print(html2text("<b>X <a>Y</a></b>")))  # returns "**XY**" => INVALID (expected "**X Y**")
  • Version by html2text --version: 2020.1.16
  • Python version python --version: 3.6.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions