Alir3z4 / Alir3z4/html2text

Extra space after a closing emphasis mark

Offen
#405 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
2.2k
Forks
296
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

```
$ echo 'hello'{\,,\",:,\[,.,\!,\?}'
' | html2text
_hello_ ,
_hello_ "
_hello_ :
_hello_[
_hello_.
_hello_!
_hello_?

```
Note in the first three lines of the output, there is an extra space after the closing `_` emphasis mark.

This is a bug, because Markdown has no problem with a punctuation immediately following the closing emphasis mark:
```
$ echo _hello_{\,,\",:,\[,.,\!,\?} | markdown

hello, hellohello: hello[ hello. hello! hello?


```
The same rendered by GitHub: _hello_, _hello_" _hello_: _hello_[ _hello_. _hello_! _hello_?

I guess the extra space is added here:

https://github.com/Alir3z4/html2text/blob/099c4b8bfeea09d640e18324bb1d44f051371940/html2text/__init__.py#L295-L297

Or here, which explains why the bottom four results don't have the extra space:

https://github.com/Alir3z4/html2text/blob/099c4b8bfeea09d640e18324bb1d44f051371940/html2text/__init__.py#L860-L868

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.