Closed lenhatthanh20 closed 10 months ago
More info:
When I enable the config Core.CollectErrors
. The Lexer implementation will be DirectLex
(auto detect) at this line: https://github.com/ezyang/htmlpurifier/blob/master/library/HTMLPurifier/Lexer.php#L99-L100
And when disable Core.CollectErrors
, the Lexer implementation is DOMLex
in my application.
I think that I can use the DirectLex
implementation with the config Core.LexerImpl
to fix this issue.
But do you have any recommendations for me? Because I think that the DOMLex
seem to be better than DirectLex
.
Thank you.
Not much you can do about it. DOMLex uses libxml, so you get whatever the C code does, it's not really customizable. To have a speedy lexer someone has to write a C extension for it. Maybe in 2023 someone has written it and I just don't know about it lol.
Thank you for your response.
What do you think if I hard config Core.LexerImpl
always use DirectLex
?
Yeah you can just change the config directly
Dear team,
Following the enduser customize docs here: http://htmlpurifier.org/docs/enduser-customize.html I'm trying to custom heading elements (h1, h2, h3, h4, h5, h6) following my code:
And I made a unit test with below input (dirty html):
And I expect that the
heading elements
will allowtable
,tbody
,tr
,td
,span
,a
elements as their children. But the actual result is not my expected.My expected:
But the actual result is:
And there is something very strange. When I enable
Core.CollectErrors
, my test is passed. I don't know why.$config->set('Core.CollectErrors', true);
Kindly help to take a look of this issue. Thank you so much for your support.