Html2Markdown icon indicating copy to clipboard operation
Html2Markdown copied to clipboard

Line breaks kill italics

Open ShawnTheBeachy opened this issue 8 years ago • 6 comments

I have some HTML like this:

<i>Some text</br></i>

It's a strange way of doing it, but I have no control over the HTML. The problem is that this causes the converter to incorrectly render the markdown. It would be nice if elements in between the </i> didn't break it.

ShawnTheBeachy avatar Jan 10 '17 00:01 ShawnTheBeachy

@RareNCool that is not valid HTML 2017-01-10_0913

What would expect to happen?

baynezy avatar Jan 10 '17 09:01 baynezy

@baynezy Sorry, I was typing from memory.

Here's the exact HTML: <br></div><div>Whispering, <i>I love you, before long I die, <br></i></div><div>I have travell’d a long way merely to look on you to touch you,

from which I get (with HTML2Markdown):

md

The desired behavior would be for it to know that </i> is closing italics and act accordingly, but I understand if that's too complicated to implement.

ShawnTheBeachy avatar Jan 11 '17 02:01 ShawnTheBeachy

@RareNCool - what is wrong with that? Or rather what would you expect it to do? For accuracy maybe create a Gist of what you expect and then link to that here.

baynezy avatar Jan 11 '17 09:01 baynezy

@TastesLikeTurkey - is this still a valid issue?

baynezy avatar Apr 30 '17 05:04 baynezy

@baynezy Apologies, I forgot to ever respond. I think it still is, trying it at your demo page. For example, this:

<i>Hello there
I am Lord Foulspleen</i>

which is perfectly valid HTML, is converted to:

*Hello there
I am Lord Foulspleen*

which most Markdown renderers don't render correctly.

It would be nice if tags in the middle of other tags were handled correctly (adding a * at the end of the first line and the beginning of the second). But I don't know how feasible this is. If it's not something you want to bother with I can always try to come up with my own solution, too.

Hopefully this example is clear:

<i>Hello,<br />I am Lord Foulspleen</i>

would become:

*Hello,*\n*I am Lord Foulspleen*

ShawnTheBeachy avatar Apr 30 '17 20:04 ShawnTheBeachy

Blocked by #45

baynezy avatar Sep 28 '17 10:09 baynezy