fileAttachmentsDisk('uploads') ->toHtml(); return $this->sanitizer()->sanitize($html); } public function readingMinutes(?string $html): int { $words = str_word_count(strip_tags((string) $html), 0, 'ÄÖÜäöüß'); return max(1, (int) ceil($words / 200)); } private function sanitizer(): HtmlSanitizer { $config = (new HtmlSanitizerConfig) ->allowSafeElements() ->allowLinkSchemes(['https', 'http', 'mailto', 'tel']) ->allowRelativeLinks() ->allowMediaSchemes(['https', 'http']) ->allowRelativeMedias() ->forceAttribute('a', 'rel', 'noopener noreferrer') ->dropElement('iframe') ->withMaxInputLength(500_000); return new HtmlSanitizer($config); } }