Resolve #3507447 "Markup that breaks"
1 unresolved thread
Closes #3507447
Merge request reports
Activity
52 $result = $hl->highlightAuto($node->textContent); 53 } 54 elseif ($mode === 'manual' && $regex) { 55 preg_match($regex, $document->saveHTML($node), $matches); 56 if (isset($matches[1])) { 57 $result = $hl->highlight($matches[1], $node->textContent); 46 if ($mode === 'auto') { 47 $hl->setAutodetectLanguages(explode(' ', trim($config->get('auto_languages') ?? 'php javascript'))); 48 } 49 50 $document = Html::load($html); 51 $xpath = new \DOMXPath($document); 52 $modified = FALSE; 53 54 /** @var \DOMElement $node */ 55 foreach ($xpath->query('//code[not(ancestor::code)]') as $node) { ensures that only
elements that are not inside another
get processed.
This is actually only thing needed to fix the error. Only downside is that it's combining
tags to one. Testing with lot of content that looked good.
Here's the test case: !3 (diffs)
Edited by Hannes Kirsmanchanged this line in version 2 of the diff
added 1 commit
- e1a96300 - Make the change minimal, keeping tests basically the same.
Please register or sign in to reply