- Issue created by @John_B
- 🇬🇧United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)
It seems that Html::normalize in TocBuilder.php is fixing mismatching tags when using PHP's DOMDocument class for HTML, as Drupal 9 does.
As a result, toc_api module is fixing broken HTML which would not be fixed by Drupal's core 'Fix broken HTML' filter.
However, this function is not fixing mismatching tags when using Mastermind/html5-php, used by D10's html utility.
- 🇬🇧United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)
In case someone wants to use the idea I suggested in #3224559: Invalid HTML causes errors → of calling the PHP HTML Tidy extension, here is a patch which does that.
- Status changed to Needs work
28 days ago 7:56pm 30 June 2025 - 🇨🇦Canada joseph.olstad
Please note, 1.x is no longer supported
All MRs should now be reviewed and made to go against 2.0.x if still needed
- First commit to issue fork.
- 🇨🇦Canada joseph.olstad
Would be best to wrap the normal processing logic/call in a try/catch, perform normal processing in the try, and if there's mangled html catch the exception, log it in the dblog so that people know about it, ideally it would be optional to auto-correct faulty html so add a configuration option for this and ONLY autocorrect the faulty HTML if you've first logged that an exception due to faulty html has occured and conditionally based on the configuration option value then and only then do the autocorrection.