friendica-sekretaerbaer-netz/src
Random Penguin 403b0672e6
Strip HTML tags from content sent as Markdown
The "toMarkdown" function prepares content to be sent, primarily, to Diaspora.

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 "To strip HTML tags that don’t have a Markdown equivalent while preserving the content inside them, set strip_tags..."

Diaspora, however, does not appear to know what to DO with the HTML sent to it. It actually appears to encode the HTML and displays the code in the post body rather than rendering it as HTML. In which case it would make more sense to strip out all tags that have no Markdown equivalents.
Example
The post as sent from Friendica mixed BBcode and Markdown:
[class=postbox-ocean]Norddeutscher Bürger ![Noddeutscher Bürger - Bismark Brötchen (Roger Cziwerny - pixapay)](/rscamo/……)[/class]
The BBcode gets converted into an HTML <span> tag. 

It also looks like Diaspora encoded the Markdown for the image rather than parsing it, or at the very least didn't parse it as Markdown. Yet another reason to strip out HTML that has no Markdown equivalents. It looks like it may be encoding the tags and the content inside the tags.

And, yes, I'm aware the [class] BBcode was marked as "deprecated" in the Friendica code, but it's the only way my Bookface scheme for the "Frio" theme could implement both profile "Cover Photos" and "Postboxes." Which won't display to other platforms anyway, so I don't want to see this custom BBcode removed, I just think it needs to be stripped out before content is delivered to other platforms.

(There is a related issue with Hubzilla where the raw BBcode is coming through unparsed because the [class] code apparently does not exist in Hubzilla's BBcodes. But I've no clue where or how to fix that in Friendica or if it can be as it may need to be handled on Hubzilla's end).
2025-04-26 16:44:14 -05:00
..
App Merge branch 'develop' into replace-hooks-with-eventdispatcher 2025-02-11 09:59:13 +00:00
Capabilities REUSE src directory 2024-08-24 15:27:00 +02:00
Collection/Api Fix errors in Collection namespace 2024-12-01 21:03:06 +00:00
Console Simplify AddonHelper::getAvailableAddons(), move style logic into Module class 2025-02-04 13:48:04 +00:00
Contact Fix code style 2025-01-13 13:31:54 +00:00
Content Strip HTML tags from content sent as Markdown 2025-04-26 16:44:14 -05:00
Core Fixed codestyle 2025-04-15 02:09:19 +00:00
Database Handle redirected servers in server detection. 2025-02-15 14:43:23 +00:00
Event Create Events for protocol support hooks 2025-02-24 08:40:07 +00:00
Factory Support for language and publification date 2025-03-02 16:47:21 +00:00
Federation REUSE src directory 2024-08-24 15:27:00 +02:00
Model Improved support for backfilled posts 2025-03-15 05:58:58 +00:00
Moderation Replace Logger with DI::logger() in Moderation classes 2025-01-13 10:17:26 +00:00
Module Fix blurred images 2025-03-31 20:38:37 +00:00
Navigation Fix coding style in Repository\Notify and Util\Emailer 2025-01-28 07:50:30 -05:00
Network Bluesky: use did based profile links 2025-04-16 04:13:09 +00:00
Object Support for language and publification date 2025-03-02 16:47:21 +00:00
Privacy/Entity REUSE src directory 2024-08-24 15:27:00 +02:00
Profile/ProfileField REUSE src directory 2024-08-24 15:27:00 +02:00
Protocol Bluesky: use did based profile links 2025-04-16 04:13:09 +00:00
Render REUSE src directory 2024-08-24 15:27:00 +02:00
Security Fix code style 2025-01-13 13:31:54 +00:00
System Make PHP-CS even more happy :) 2025-01-02 12:54:39 +01:00
User/Settings REUSE src directory 2024-08-24 15:27:00 +02:00
Util Add support for more datetime formats 2025-03-18 19:01:42 -04:00
Worker Add missing public contacts and account-user entries 2025-03-18 05:33:01 +00:00
App.php Fixes: Uncaught Exception TypeError: "array_merge(): Argument #1 must be of type array, int given" 2025-02-16 05:59:23 +00:00
AppHelper.php Create AppHelper interface and AppLegacy class 2024-11-17 20:06:34 +00:00
AppLegacy.php Mark more new classes as internal 2025-01-22 19:52:48 +00:00
BaseCollection.php use get_class() instead of static() in BaseCollection 2024-11-11 23:40:45 +00:00
BaseDataTransferObject.php REUSE src directory 2024-08-24 15:27:00 +02:00
BaseEntity.php remove unnecessary properties from BaseEntity 2024-12-07 06:58:11 +00:00
BaseFactory.php REUSE src directory 2024-08-24 15:27:00 +02:00
BaseModel.php fix errors in BaseModel 2024-12-01 20:51:57 +00:00
BaseModule.php Improved Mastodon API compatibility 2025-03-01 12:38:09 +00:00
BaseRepository.php REUSE src directory 2024-08-24 15:27:00 +02:00
DI.php Merge branch 'develop' into new-addonproxy 2025-02-05 19:20:27 +00:00
LegacyModule.php Remove DI::app() call from LegacyModule 2024-11-23 08:27:40 +00:00