Postbox Add-Ons for Friendica
Bookface 1.6 introduces a new feature called "Postboxes" that allows you to create a post with a colorful background like a similar feature on Facebook. It's built into the Bookface scheme, but I also created TWO add-ons for Friendica if a server administrator wants to roll it out for all of their users regardless of what theme they prefer.
Postbox: simply adds a minified stylesheet to the head with the Postbox styling. It doesn’t add any interface for creating a Postbox, but users can still create them manually with BBcode.
Zen Postbox: adds the minified stylesheet to the head, but also adds a tool to the post composer to insert a Postbox or wrap selected text in one.
To manually create a Postbox just wrap your text in the Postbox class BBcode like this:
[class=postbox-redblue]Text that will be wrapped[/class]
Make sure to PREVIEW it before you post it! While Friendica's Postboxes do allow more content than just plain text, certain formatting blocks can't be placed inside them.
If everything looks good, go ahead an POST it. Anyone using Bookface or any server using either the "Postbox" or "Zen Postbox" add-ons will see it like this:
If the "Zen Postbox" add-on is enabled it adds a button for wrapping/inserting a Postbox to the post editor:
Full Documentation of the "Zen Postbox" add-on is available as a GitLab Wiki.
Keep in mind that other servers that don't implement Postbox styling, other platforms (like Mastodon), and third-party apps will not show these colored backgrounds. This feature only works in the Friendica webapp/website.
#bookface #friendica @Friendica Admins @Friendica Developers
Wilhelm likes this.
reshared this
Friendica Admins reshared this.
Matthias
in reply to Pygoscelis Papua • • •reshared this
Friendica Admins reshared this.
Anomaly
in reply to Pygoscelis Papua • • •reshared this
Friendica Admins reshared this.
Matthias
in reply to Pygoscelis Papua • • •It would be good if you could publish the addon at git.friendi.ca/friendica/frien… so that it is published for all Friendica nodes. Are you planning to do that?
reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Matthias • • •Well I hadn't been planning on it, but maybe?
I set up over at GitLab because I already have a work-related GitHub account and wanted to separate my personal projects and trying to manage two GitHub accounts on one computer is messy, but I also wanted to get away from Microsoft and their AI nonsense and try out GitLab as a GitHub alternative, as it seems popular with some big open-source projects. Unfortunately Friendica's repos aren't there. Which I didn't think would be an issue because I didn't originally intend to submit any of my mods to the core project.
But I found a bug in the Frio theme last night and reluctantly did set up a second GitHub account to submit my fix and a PR over there. I don't really want to move my repos to GitHub and I'd need to look into what's involved with mirroring the GitLab repos, because I definitely don't want to be trying to maintain it in two places.
@Hypolite Petovan and I have already talked about Bookface being pulled from GitLab to GitHub, so that's also possibility I guess for including the add-ons if he wants.
Wilhelm likes this.
reshared this
Friendica Admins reshared this.
Matthias
in reply to Pygoscelis Papua • • •@Pygoscelis Papua
Many thanks for that.
@Hypolite Petovan
reshared this
Friendica Admins reshared this.
Hypolite Petovan
in reply to Pygoscelis Papua • • •reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Hypolite Petovan • • •<span>
transfers but theclass="postbox-..."
gets stripped out. And even if the classname wasn't stripped Mastodon (or any other platform) would not have the stylesheet to show them as postboxes anyway. Much like the Facebook version that inspired them, they only work within this platform. People can always do what people do with the Facebook ones though, screencap them and share the images on other platforms. 😉reshared this
Friendica Admins reshared this.
Hypolite Petovan
in reply to Pygoscelis Papua • • •reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Hypolite Petovan • • •reshared this
Friendica Admins reshared this.
Hypolite Petovan
in reply to Pygoscelis Papua • • •reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Hypolite Petovan • • •[class]...[/class]
BBcode or someone would've noticed a parsing error like that. Which looks like Friendica is sending it already converted to<span>
but is it sending as HTML or is it sending it as<span>
or<span=
because I would assume Diaspora knows how to handle actual tags? But the Postboxes are coming though to Mastodon as actual<span>...</span>
tags. 🤷♀️reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Pygoscelis Papua • • •reshared this
Friendica Admins reshared this.
Matthias
in reply to Pygoscelis Papua • • •@Pygoscelis Papua
Post to Bluesky
Post to tumblr
reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Matthias • • •Thank you @Matthias !
Now I guess the question for the ones that are messed up is whether the problem is in how Friendica sends the post data or if it's how the platform that receives it is parsing it?
I tried looking through the Friendica code myself trying to find where post data gets processed to send to each other platform and I can't make head nor tail of it. Though I did run across a comment that
[class]
was "deprecated since 2021.12, left for backward-compatibility reasons" but doesn't way why it was deprecated. I hope it doesn't get removed because it's also how I'm making the "Cover Photos" work in Bookface.reshared this
Friendica Admins reshared this.
Hypolite Petovan
in reply to Pygoscelis Papua • • •reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Hypolite Petovan • • •Since the BBcode is replaced with
<span>...</span>
shouldn't it be trivial to simply send the wrapped content without the wrapper to other platforms?Like the difference between:
$text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism", '<span class="$1">$2</span>', $text);
and$text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism", '$2', $text);
reshared this
Friendica Admins reshared this.
Hypolite Petovan
in reply to Pygoscelis Papua • • •reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Hypolite Petovan • • •[class]
wrapper since other platforms can't use it anyway. There isn't anything similar in Markdown so far as I know, which might be why the raw BBcode is getting through to Disapora? I'm guessing it's missing the conversion from BBcode[class]
to Markdown syntax. Which should be conversion to nothing. I'd check for it myself but I have no clue where the processing for other platforms even is in the Friendica code.reshared this
Friendica Admins reshared this.
Pygoscelis Papua
in reply to Pygoscelis Papua • • •Ok, I’ve been trying to follow the Friendica code and I may be reading it wrongly, but it looks to me like the BBcode gets converted to HTML for most platforms, but then that HTML gets converted to Markdown for Diaspora (and I think Hubzilla?). But if that’s the case I don’t understand how the BBcode is getting all the way through to those other platforms as shown in the screenshots @Matthias posted?
It looks to me like it should be sending the
<span>
to them as well not the raw BBcode, because it seems the HTML to Markdown converter by default "preserves HTML tags without Markdown equivalents like<span>
and<div>
." At least according to the README in /friendica/vendor/league/html-to-markdown/ - which also says [i]“To strip HTML tags that don’t have a Markdown equivalent while preserving the content inside them, set strip_tags…"So in:
/friendica
... Show more...Ok, I’ve been trying to follow the Friendica code and I may be reading it wrongly, but it looks to me like the BBcode gets converted to HTML for most platforms, but then that HTML gets converted to Markdown for Diaspora (and I think Hubzilla?). But if that’s the case I don’t understand how the BBcode is getting all the way through to those other platforms as shown in the screenshots @Matthias posted?
It looks to me like it should be sending the
<span>
to them as well not the raw BBcode, because it seems the HTML to Markdown converter by default "preserves HTML tags without Markdown equivalents like<span>
and<div>
." At least according to the README in /friendica/vendor/league/html-to-markdown/ - which also says [i]“To strip HTML tags that don’t have a Markdown equivalent while preserving the content inside them, set strip_tags…"So in:
/friendica/src/Content/Text/HTML.php
If I change line 684 from :
to
The Postbox
<span>
is removed but whatever’s inside it is not. Is there any particular reason to preserve HTML that has no Markdown equivalents for platforms that want Markdown format?Or am I completely barking up the wrong tree here?
@Hypolite Petovan
reshared this
Friendica Admins reshared this.