修改此标记的 htmlpurifier 允许标签 [英] Modifying htmlpurifier allowed tags for this markup
问题描述
我的 html 净化器设置现在只允许这些标签
My html purifier settings now allow only these tags
$configuration->set('HTML.Allowed', 'p,ul,ol,li');
我想允许缩进列表,我的编辑器使用这个 html
I want to allow indentation of lists and my editor uses this html
<ul style="margin-left: 40px;">
我应该如何更改 HTMLPurifier Allowed 标签?我想添加 style
,但我认为最好明确指定允许的样式,在这种情况下是 margin-left
.更改 HTML 的正确方法是什么.在这种情况下允许吗?
How should I change my HTMLPurifier Allowed tags? I thought to add style
, but I think it would be better to specify exactly which style is allowed, which in this case would be margin-left
. What is the right way to change the HTML.Allowed for this case?
推荐答案
允许样式属性,然后使用 %CSS.AllowedProperties.
Allow the style attributes, and then modify the allowed CSS attributes using %CSS.AllowedProperties.
$configuration->set('HTML.Allowed', 'p,ul[style],ol,li');
$configuration->set('CSS.AllowedProperties', 'margin-left');
附言我很惊讶有多少人不了解 HTML Purifier 的工作原理.
P.S. I'm surprised how many people don't understand how HTML Purifier works.
这篇关于修改此标记的 htmlpurifier 允许标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!