Open mrvdb opened 10 years ago
Do you mean something like using a proportional width font when displaying rendered HTML content? Elfeed relies on shr.el for HTML rendering, so it would primarily be a matter of customizing its settings.
No, the usecase i have as follows.
I subscribe to a feed which gives me diffs of wiki pages, so one entry in the feed is a bit of headery and the content is just a diff (plain text) Feed is this one: http://tsfkb.com/feed.php?type=rss2
When I normally view at diffs in emacs, diff-mode
is activated, what I would like is to be able to say:
"for this feed, turn on diff-mode for the content part region of this feed", for example by reacting on a tag added to the feed.
That's an interesting idea in general, but neither Atom or RSS have any way to include content other than HTML and plain text. The only way to do this is with an enclosure, where you can specify any MIME type you like, but that content is in a separate document and I'm not concerned with handling those directly in Elfeed other than to provide a link. Someone could write an Elfeed extension to download enclosures and attempt to display them in a buffer, using the MIME type to select the major mode.
For example, the RSS feed you linked is actually serving HTML with the diff in a <pre>
tag. There's no indication the content within the HTML is primarily a diff. For Emacs to recognize this as a diff would require rendering the HTML, then examining the result to determine what kind of information it might be. That's flaky and there are too many ways for this to go wrong. What if there's a tiny bit of content outside the pre
tags? There's not really any way to generally solve this problem.
If the diff HTML included the highlighting you want via embedded css/style attributes, you'd automatically see that in Elfeed. If you're really desperate to have this in this particular feature for this particular feed, and you have no way to control/change the feed directly, you could accomplish it via a new entry hook function. When new entries arrive from this feed you could manipulate the entry content to have the desired style attributes, perhaps via htmlize.el.
Yes, the lack of meta-info is a pity. This would be under user control, not automatic. For the feed linked, I'd ask the site to just wrap it in CDATA as plain text so the scanning would be limited to just that.
Plain text is what emacs is good at though. Isn't the main problem to isolate the region to apply the mode to? Well, and perhaps the 'multi-mode' like behaviour.
I have a few feeds that have a clear content type which could be displayed a bit more intelligent in Emacs.
An example is diff-feeds for commit logs or wiki sites, which i use to keep track of what has changed and if it needs my attention or not. Currently these diffs are just displayed as one blob of text. If the mode of the content part could somehow react to it and display it like diff-mode would, including perhaps a limited set of keybindings of that mode, this would make reading that content a lot more pleasant.