Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 403]

This filter provides automatic support for MathJax

Copyright: 2013 Damyon Wiese (damyon@moodle.com)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 249 lines (10 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class

filter_mathjaxloader:: (5 methods):
  map_language_code()
  setup()
  filter()
  wrap_math_in_nolink()
  insert_span()


Class: filter_mathjaxloader  - X-Ref

Mathjax filtering

map_language_code($moodlelangcode)   X-Ref
No description

setup($page, $context)   X-Ref
No description

filter($text, array $options = array()   X-Ref
No description

wrap_math_in_nolink($text)   X-Ref
Find math environments in the $text and wrap them in no link spans
(<span class="nolink"></span>). If math environments are nested, only
the outer environment is wrapped in the span.

The recognized math environments are \[ \] and $$ $$ for display
mathematics and \( \) for inline mathematics.

param: string $text The text to filter.
return: array An array containing the potentially modified text and

insert_span($text, $start, $end)   X-Ref
Wrap a portion of the $text inside a no link span
(<span class="nolink"></span>). The whole text is then returned.

param: string $text The text to modify.
param: int $start The start index of the substring in $text that should
param: int $end The end index of the substring in $text that should be
return: string The whole $text with the span inserted around