I want to add all A elements target="_blank" attribute or change value to "_blank" if different. Is this possible with HTMLPurifier? I couldn't find any information or documentation about this on the internet. For example;
Input
<a href="some_url">Link 1</a>
<a href="some_url" target="_self">Link 2</a>
<a href="some_url" target="_blank">Link 3</a>
Current Output
<a href="some_url">Link 1</a>
<a href="some_url">Link 2</a>
<a href="some_url" target="_blank">Link 3</a>
Desired Output
<a href="some_url" target="_blank">Link 1</a>
<a href="some_url" target="_blank">Link 2</a>
<a href="some_url" target="_blank">Link 3</a>
Current Configs
$config = \HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', 'a[href|target]');
$config->set('Attr.AllowedFrameTargets', array('_blank'));
I am not asking 'How can I allow custom tags?'. The problem is 'Can I manipulate attribute value with HTMLPurifier if value different than _blank?'.