Mirror of the github repository
Find a file
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
.ddev added SPDX header information to some files 2024-08-23 08:23:28 +02:00
.devcontainer Update docs and scripts to use the correct composer install script 2025-02-06 07:43:52 +00:00
.github Change output format in Github 2024-12-25 16:17:31 +00:00
.tx added SPDX header information to some files 2024-08-23 08:23:28 +02:00
.woodpecker [CI] avoid safe.directory issues when cloning 2025-03-15 00:18:39 +01:00
bin Fix version in deprecation message 2025-02-10 07:11:24 +00:00
config Remove old config parts 2023-02-18 21:12:20 +01:00
doc remove BC for extending any non-abstract class 2025-03-12 11:06:28 +01:00
images Add missing platform icon 2024-11-11 08:20:04 +01:00
LICENSES Preparation für multiple icon styles / improved code 2024-11-10 19:50:01 +00:00
mod Merge branch 'develop' into replace-hooks-with-eventdispatcher 2025-02-11 09:59:13 +00:00
mods Replace 'bin/worker.php' calls and help 2025-01-05 23:13:39 +01:00
spec spelling: resolvable 2023-03-26 16:14:16 -04:00
src Strip HTML tags from content sent as Markdown 2025-04-26 16:44:14 -05:00
static Support for language and publification date 2025-03-02 16:47:21 +00:00
tests Fix formatting in DateTimeFormatTest 2025-03-18 19:07:25 -04:00
view [frio] Fix Safari bug where notification icon jumps to next line 2025-03-05 19:08:14 -05:00
.codecov.yml added SPDX header information to some files 2024-08-23 08:23:28 +02:00
.editorconfig added SPDX header information to some files 2024-08-23 08:23:28 +02:00
.gitattributes added SPDX header information to some files 2024-08-23 08:23:28 +02:00
.gitignore Merge branch 'develop' into introduce-phpmd 2025-02-11 07:57:29 +00:00
.gitmodules adjust2 2012-03-02 17:18:11 +01:00
.htaccess-dist added SPDX header information to some files 2024-08-23 08:23:28 +02:00
.php-cs-fixer.dist.php Fixup 2024-08-24 19:03:41 +02:00
.phpmd-ruleset.xml Increate ExcessiveClassComplexity rule to 800 2025-01-23 14:16:56 +00:00
.phpmd-ruleset.xml.license Add license file for phpmd ruleset 2025-01-09 14:16:33 +00:00
.phpstan.neon Let phpstan check the jetstream.php file 2024-12-28 23:04:50 +00:00
CHANGELOG Update CHANGELOG 2025-01-02 14:37:53 +01:00
CHANGELOG.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
composer.json Merge pull request #14622 from Art4/introduce-phpmd 2025-02-12 11:22:26 -05:00
composer.lock Merge branch 'develop' into introduce-phpmd 2025-02-11 07:57:29 +00:00
CONTRIBUTING.md Replace "forum" by "group" in documentation 2023-06-02 13:52:40 -04:00
CONTRIBUTING.md.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
CREDITS.txt updated credits 2024-10-24 20:28:17 +02:00
CREDITS.txt.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
database.sql Support for language and publification date 2025-03-02 16:47:21 +00:00
docblox.dist.xml ident_size 2 is better for XML readability :) 2023-02-27 20:57:19 +01:00
docblox.dist.xml.license REUSE licenses added 2024-08-24 12:23:11 +02:00
Doxyfile Legacy "include" fragments have been removed 2022-10-20 04:21:00 +00:00
Doxyfile.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
FEDERATION.md removed comment 2024-08-18 08:51:19 +02:00
FEDERATION.md.license REUSE licenses added 2024-08-24 12:23:11 +02:00
index.php Update docs and scripts to use the correct composer install script 2025-02-06 07:43:52 +00:00
LICENSE Fix license text 2021-03-28 01:18:34 +01:00
README.md Update README.md: fixing links for mobile screenshots 2024-01-03 16:08:18 +01:00
README.md.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
REUSE.toml fix reuse for translation files 2024-10-16 05:40:44 +00:00
REUSE.toml.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
ruleset.xml ident_size 2 is better for XML readability :) 2023-02-27 20:57:19 +01:00
ruleset.xml.license REUSE licenses added 2024-08-24 12:23:11 +02:00
security.txt bumb version 2024.08 2024-08-17 17:28:43 +02:00
security.txt.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
translations.txt.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
update.php Fix code style 2025-01-13 13:31:54 +00:00
Vagrantfile [Vagrant] Upgrade to bookworm 2024-12-30 15:30:43 +01:00
Vagrantfile.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00
VERSION Welcome version 2025.02-dev! 2025-01-01 12:16:35 -05:00
VERSION.license added SPDX header information to some files 2024-08-23 08:23:28 +02:00

Friendica - your open and free social network

Welcome to the free social web. Friendica is a platform for decentralised social communication linking to other independent social and corporate services.

Friendica connects you to a federated communications network of thousands of servers called the Fediverse. Through various protocols you can interact with anyone on Friendica, Mastodon, Lemmy, Diaspora, Misskey, Peertube, Pixelfed, Pleroma and many more. Receiving content from Tumblr, WordPress and RSS is also possible. Friendica allows to import and mirror your content via add-ons such as ITTT and Buffer. You can control the privacy scope of your content.

Being part of the Fediverse allows you to be free from data-harvesting corporations. Enjoy open social communication, independent of any specific provider.

Join Friendica today or set up your own Friendica instance.

Friendica on desktop

Frio theme in desktop browser

Friendica on mobile

frio on mobile, dark color scheme frio on mobile, light color scheme

Endorsements