19 declare(strict_types=1);
26 private const MATHJAX2_DEFAULT_URL =
'https://cdn.jsdelivr.net/npm/mathjax@2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML,Safe';
49 string $client_polyfill_url,
50 string $client_script_url,
53 string $server_address,
55 bool $server_for_browser,
56 bool $server_for_export,
60 $this->client_polyfill_url = trim($client_polyfill_url);
61 $this->client_script_url = trim($client_script_url);
62 $this->client_limiter = (in_array(
64 [self::LIMITER_MATHJAX, self::LIMITER_TEX, self::LIMITER_SPAN]
67 $this->server_address = trim($server_address);
79 return self::MATHJAX2_DEFAULT_URL;
87 return ILIAS_HTTP_PATH .
'/' . self::MATHJAX3_RELATIVE_URL;
130 self::LIMITER_MATHJAX =>
'\​(...\​)',
131 self::LIMITER_TEX =>
'[tex]...[/tex]',
132 self::LIMITER_SPAN =>
'<span class="math">...</span>' 141 switch ($this->client_limiter) {
142 case self::LIMITER_TEX:
144 case self::LIMITER_SPAN:
145 return '<span class="math">';
146 case self::LIMITER_MATHJAX:
157 switch ($this->client_limiter) {
158 case self::LIMITER_TEX:
160 case self::LIMITER_SPAN:
162 case self::LIMITER_MATHJAX:
221 $clone = clone $this;
231 $clone = clone $this;
232 $clone->client_polyfill_url = $client_js_url;
241 $clone = clone $this;
242 $clone->client_script_url = $client_async_url;
251 $clone = clone $this;
261 $clone = clone $this;
271 $clone = clone $this;
281 $clone = clone $this;
291 $clone = clone $this;
301 $clone = clone $this;
311 $clone = clone $this;
withClientLimiter(int $client_limiter)
Set the type of enclosing limiters for wich the embedded client-side Mathjax is configured.
withServerTimeout(int $server_timeout)
Set the timeout (s) to wait for the result of the rendering server.
isServerForPdf()
Should the server-side rendingeing be used for PDF generation.
getClientLimiterStart()
Start limiter of Latex code which the client-side Mathjax searches for.
getClintPolyfillUrl()
Url of a javascript polyfill (needed by MathJax 3)
withClientScriptUrl(string $client_async_url)
Set the url of Mathjax script to be embedded on the page (for MathJax 3)
getMathJax3DefaultUrl()
Get the default URL for including MathJax 3.
isServerForExport()
Should the server-side rendingeing be used for HTML exports.
Global Mathjax configuration.
withServerAddress(string $server_address)
Set the url of the Mathjax server.
isServerEnabled()
Is a server side rendering engine configured and enabled.
getServerAddress()
Url of Mathjax server.
withServerForPdf(bool $server_for_pdf)
Enable the server-side rendingeing for PDF generation.
__construct(bool $client_enabled, string $client_polyfill_url, string $client_script_url, int $client_limiter, bool $server_enabled, string $server_address, int $server_timeout, bool $server_for_browser, bool $server_for_export, bool $server_for_pdf)
Constructor.
getClientLimiter()
Type of enclosing limiters for wich the embedded client-side Mathjax is configured.
getClientScriptUrl()
Url of Mathjax script to be embedded with script tag on the page.
withClientEnabled(bool $client_enabled)
Enable latex code bing rendered in the browser.
withClientPolyfillUrl(string $client_js_url)
Set the url of a polyfill script neededby MathJax 3.
isClientEnabled()
Should latex code be rendered in the browser.
withServerEnabled(bool $server_enabled)
Enable a server side rendering engine configured and enabled.
withServerForExport(bool $server_for_export)
Enable the server-side rendingeing for HTML exports.
getClientLimiterOptions()
Get the avaliable options for the client limiters.
getServerTimeout()
timeout (s) to wait for the result of the rendering server
string $client_polyfill_url
getClientLimiterEnd()
End limiter of Latex code which the client-side Mathjax searches for.
withServerForBrowser(bool $server_for_browser)
Enable the server-side rendingeing for browser output.
getMathJax2DefaultUrl()
Get the default URL for including MathJax 2.
const MATHJAX2_DEFAULT_URL
isServerForBrowser()
Should the server-side rendingeing be used for browser output.
const MATHJAX3_RELATIVE_URL
string $client_script_url