]> git.mxchange.org Git - friendica.git/commit
Strip HTML tags from content sent as Markdown
authorRandom Penguin <205060075+randompenguin1@users.noreply.github.com>
Sun, 20 Apr 2025 17:05:26 +0000 (12:05 -0500)
committerGitHub <noreply@github.com>
Sun, 20 Apr 2025 17:05:26 +0000 (12:05 -0500)
commit09c606181084b78dba9c279dee91a633eae7dce4
treeb32e1c4010e99c8edf8c9a6edf08a941097c804c
parentcd3d412a59717c65921f1044c5c8f033edbc530c
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.
src/Content/Text/HTML.php