html2text icon indicating copy to clipboard operation
html2text copied to clipboard

Support citation style links

Open Necoro opened this issue 4 years ago • 1 comments

This PR is similar to #32, with the following deviations:

  • only citation style links, no omitTableNodes etc
  • multiple links to the same URL get the same citation index (just as citations work :))
  • write directly into the buffer instead of string concatenation in a loop

Also, as a side effect, when determining where to add spaces, punctuation is taken into account. That is, no spaces are added before '?', ')', ... and no spaces are added after '(', '[', ...

Thus

Here is a <a href="http://example.com/">link</a> to some page. And <a href="http://google.com">another link</a>, too. 
And the <a href="http://example.com">first link</a> again.

renders as

Here is a link [1] to some page. And another link [2], too.
And the first link [1] again.

[1] http://example.com
[2] http://google.com

Necoro avatar May 10 '20 15:05 Necoro

Sorry for the noise, Github did not work as I expected it to work :)

Necoro avatar Jul 24 '21 11:07 Necoro