Skip to content

how to add custom attribute to whitelist by edit config.yml #26

@jamesBan

Description

@jamesBan

I use this bundle in my project, i want to konw how to setting config.yml.
this is the raw HTMLPurifier code.

<?php
$dirty_html = <<<EOF
<img src="https://github.com/my.jpg" data-type="5" alt="" data-image-size="100,200" />
EOF;

$config = HTMLPurifier_Config::createDefault();
$def = $config->getHTMLDefinition(true);
$def->addAttribute('img', 'data-type', 'Text');
$def->addAttribute('img', 'data-image-size', 'Text');
$purifier = new HTMLPurifier($config);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions