if ($hasinline || $hasdisplay || $hasextra) {
$PAGE->requires->yui_module('moodle-filter_mathjaxloader-loader', 'M.filter_mathjaxloader.typeset');
if ($hasextra) {
+ // If custom dilimeters are used, wrap whole text to prevent autolinking.
$text = '<span class="nolink">' + $text + '</span>';
} else {
if ($hasinline) {
+ // If the default inline TeX delimiters \( \) are present, wrap each pair in nolink.
$text = preg_replace('/\\\\\\([\S\s]*?\\\\\\)/u',
'<span class="nolink">\0</span>', $text);
}
if ($hasdisplay) {
+ // If default display TeX is used, wrap $$ $$ or \[ \] individually.
$text = preg_replace('/\$\$[\S\s]*?\$\$|\\\\\\[[\S\s]*?\\\\\\]/u',
'<span class="nolink">\0</span>', $text);
}