doujia7517 2010-12-30 21:10
浏览 58
已采纳

带有html5 doctype的htmlpurifier

Is it possible to have htmlpurifier use the html5 doctype?

The documentation here states that you can change the doctype and encoding with the following:

<?php
    require_once '/path/to/htmlpurifier/library/HTMLPurifier.auto.php';

    $config = HTMLPurifier_Config::createDefault();
    $config->set('Core', 'Encoding', 'ISO-8859-1'); // replace with your encoding
    $config->set('HTML', 'Doctype', 'HTML 4.01 Transitional'); // replace with your doctype
    $purifier = new HTMLPurifier($config);

    $clean_html = $purifier->purify($dirty_html);
?>

but then in the install instructions here states that the supported doctypes are:

256 Other supported doctypes include:
257
258     * HTML 4.01 Strict
259     * HTML 4.01 Transitional
260     * XHTML 1.0 Strict
261     * XHTML 1.0 Transitional
262     * XHTML 1.1

Is it possible to do the following to allow html5 doctype?

<?php
        require_once '/path/to/htmlpurifier/library/HTMLPurifier.auto.php';

        $config = HTMLPurifier_Config::createDefault();
        $config->set('Core', 'Encoding', 'UTF-8'); // replace with your encoding
        $config->set('HTML', 'Doctype', 'html5'); // replace with your doctype
        $purifier = new HTMLPurifier($config);

        $clean_html = $purifier->purify($dirty_html);
    ?>

Or is there another way?

  • 写回答

6条回答 默认 最新

  • dongshan8953 2010-12-31 00:19
    关注

    No, HTML Purifier does not currently support HTML 5.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥15 使用LM2596制作降压电路,一个能运行,一个不能
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错