html2text_ruby icon indicating copy to clipboard operation
html2text_ruby copied to clipboard

Options for URL matching and output

Open sebbASF opened this issue 6 years ago • 2 comments

The code considers the href and text to be the same for both these cases:

(A) <a href="https://a.b.c">a.b.c</a> (B) <a href="http://a.b.c">a.b.c</a>

Both are rendered as 'a.b.c'

However it does not consider the following to be the same:

(C) <a href="http://a.b.c/">a.b.c</a>

So the output is rendered as '[a.b.c](http://a.b.c/)'

I think the href in (A) should not be considered equal, whereas I expect (C) to render as 'a.b.c'.

For some circumstances, it might also be useful to keep the '[text](url)' format regardless of equality.

Maybe it would be useful to do the URL matching in a separate function that could optionally be provided by callers?

Additionally perhaps allow the output format to be varied, e.g. as 'text <url>' which seems to be common in text portions of mime mails.

sebbASF avatar Aug 24 '19 22:08 sebbASF

Hello! I think your comment lost some of the formatting, so I can't see what the problem is - can you please repost (you may have to use backticks to force GitHub/Markdown to not format the code)? Thank you!

soundasleep avatar Aug 25 '19 21:08 soundasleep

Oops, edited original post. Hope that is clear now.

sebbASF avatar Aug 27 '19 09:08 sebbASF