2

Back in rss2email 2.70, links were emitted as Markdown reference links at the end of a post:

blah blah [blah blah][1] blah bleh

  [1]: http://www.example.com/blah-blah/

URL: http://www.example.com/blahs

However, with a modern version of rss2email (specifically in my case, 3.9), links are emitted as inline Markdown links. What's worse, they end up being word wrapped!

blah blah [blah blah](http://www.example.com/blah-
blah/) blah bleh

URL: http://www.example.com/blahs

The only relevant configuration option I've been able to find is links-after-each-paragraph, which is described as:

Put the links after each paragraph instead of at the end.

I can't seem to find anything that controls whether links are emitted as inline or reference Markdown links.

How can I get rss2email 3.9 to emit reference Markdown links for links in the blog post content?

user
  • 28,161
  • 13
  • 75
  • 138

1 Answers1

1

This change seems to be due to changes the python3 version of html2text, a package used by rss2email. This usage for that package talks about command line option --reference-links doing what you want: "Use reference links instead of inline links to create markdown". Looking through its python code this becomes internal config option INLINE_LINKS that you would need to set from rss2email.

Looking at the python code in rss2email/config.py (somewhere in your /usr/lib/python*/site-packages/ directory or simlar) you can see the routine setup_html2text() is used to configure html2text:

class Config (_configparser.ConfigParser):
    ...
    def setup_html2text(self, section='DEFAULT'):
        """Setup html2text globals to match our configuration
        """
        ...
        _html2text.BODY_WIDTH = self.getint(section, 'body-width')

This would be the place to add some overriding extra configuration. However, I found that either I didn't understand this code or there is a bug, as _html2text.BODY_WIDTH is not used, but there is a _html2text.config.BODY_WIDTH which seems more correct.

By editing this file and adding to this routine the following lines (indent with spaces not tabs):

        _html2text.config.INLINE_LINKS = False
        _html2text.config.USE_AUTOMATIC_LINKS = False
        _html2text.config.LINKS_EACH_PARAGRAPH = True

I obtained mail output similar to that of earlier versions of rss2email.

meuh
  • 49,672
  • 2
  • 52
  • 114