PHP tidy disable repair feature, just indent
-
26-06-2021 - |
Question
My code looks like that
$markup = ob_get_clean();
// Specify configuration
$config = array(
'indent' => true,
'output-xhtml' => true,
'wrap' => 200);
// Tidy
$tidy = new tidy;
$tidy->parseString($markup, $config, 'utf8');
$tidy->cleanRepair();
There is a big problem: My web php code gets string from database that contains programming materials (like include , etc) and tidy gets <stdio>
as wrong tag, "repairs" (removes it from output) Is there any way to just indent code? I mean not to repair and remove parts of material like <stdio>
??
Solution
I think htmspecialchars() and htmlspecialchars_decode() functions may help you.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow