Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 414 Bytes

HtmlLinks.md

File metadata and controls

14 lines (9 loc) · 414 Bytes

HtmlLinks

This class provides support for adding target="_blank" rel="noopener noreferrer" to external links.

Usage

$html = '<h1>Hello World. Have you seen <a href="https://google.com">Google</a> today?</h1>';
$string = HtmlLinks::targetBlank($html);

// returns:
// <h1>Hello World! Have you seen <a target="_blank" rel="noopener noreferrer" href="https://google.com">Google</a> today?</h1>