hodgesmr / mastodon_digest

A Python script that aggregates recent popular posts from your Mastodon timeline
BSD 3-Clause "New" or "Revised" License
439 stars 58 forks source link

Basic support for custom themes/templates #15

Closed BenWard closed 1 year ago

BenWard commented 1 year ago

This patch adds a new argument --theme to allow specifying of different render templates for the digest. It refactors the existing digest theme without any visual modification, and adds a light variant of it by way of demonstrating the functionality.

Context: I'd like to play around with visual customisation of the digest more drastically, but since visuals are a very opinionated and personal thing, I wanted to first have the base project able to handle different templates simultaneously, so that you're not obligated to wrangle anyone's visual ideas into your default, but will be free to bundle alternate digest styles as you like, and adopt ideas into your default in whatever way makes sense.

Summary of Changes:

Aside: Unfortunately the Mastodon <iframe> embeds don't allow you to specify which theme to use within each post, so they continue to render based on the configuration of the remote server.

BenWard commented 1 year ago

The source HTML of the post, and the bio info of the accounts, are provided in the info dictionary. That means it is possible to render without iframes at all. @mauforonda has been doing some really neat work on their fork. I think such an overhaul to the included templates are out-of-scope for this PR, but I could imagine it being a reasonable change in the future. This is also somewhat captured in https://github.com/hodgesmr/mastodon_digest/issues/6.

Yep, and I included the link to documentation for info in the readme, but didn't want to get into building a whole new post rendering at the same time as this foundational change. That was part of my thinking behind the common repository for shared template partials though: I'd imagine that if someone does contribute a template for rendering posts, it could be re-usable by any theme.