Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 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: 0 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