html2text
html2text copied to clipboard
Support citation style links
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
Sorry for the noise, Github did not work as I expected it to work :)