Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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