diff --git a/webapp/composer.json b/webapp/composer.json index b3930db922..af85b2798e 100644 --- a/webapp/composer.json +++ b/webapp/composer.json @@ -71,6 +71,7 @@ "jms/serializer-bundle": "^5.2", "knplabs/knp-paginator-bundle": "^6.6", "league/commonmark": "^2.3", + "mathjax/mathjax": "^4.0", "mbostock/d3": "^3.5", "nelmio/api-doc-bundle": "^5.0", "nelmio/cors-bundle": "^2.4", diff --git a/webapp/composer.lock b/webapp/composer.lock index c6b0c1bcbb..230fca5ceb 100644 --- a/webapp/composer.lock +++ b/webapp/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "88f6e44e48730e8efd3a8ccaeefb5ed7", + "content-hash": "4309b9d291f08f0533b4c6529b37513d", "packages": [ { "name": "apalfrey/select2-bootstrap-5-theme", @@ -3089,6 +3089,56 @@ }, "time": "2024-03-31T07:05:07+00:00" }, + { + "name": "mathjax/mathjax", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/mathjax/MathJax.git", + "reference": "cfcb21644c5f06f59c0211a928690b7284073df7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mathjax/MathJax/zipball/cfcb21644c5f06f59c0211a928690b7284073df7", + "reference": "cfcb21644c5f06f59c0211a928690b7284073df7", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "MathJax Consortium", + "homepage": "https://github.com/mathjax" + } + ], + "description": "MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.", + "homepage": "http://www.mathjax.org/", + "keywords": [ + "AsciiMath", + "JS", + "MathML", + "latex", + "math" + ], + "support": { + "issues": "https://github.com/mathjax/MathJax/issues", + "source": "https://github.com/mathjax/MathJax/tree/4.0.0" + }, + "funding": [ + { + "url": "https://numfocus.org/donate-to-mathjax", + "type": "custom" + }, + { + "url": "https://github.com/numfocus", + "type": "github" + } + ], + "time": "2025-08-04T19:29:47+00:00" + }, { "name": "mbostock/d3", "version": "v3.5.17", diff --git a/webapp/public/js/domjudge.js b/webapp/public/js/domjudge.js index d500dcbac6..db45f2dc0b 100644 --- a/webapp/public/js/domjudge.js +++ b/webapp/public/js/domjudge.js @@ -939,6 +939,7 @@ function previewClarification($input, $previewDiv) { } }).done(function (data) { $previewDiv.html(data.html); + MathJax.typesetPromise([document.getElementById($previewDiv[0].id)]); }); } } diff --git a/webapp/public/mathjax b/webapp/public/mathjax new file mode 120000 index 0000000000..fac19bd5a5 --- /dev/null +++ b/webapp/public/mathjax @@ -0,0 +1 @@ +../vendor/mathjax/mathjax \ No newline at end of file diff --git a/webapp/public/mathjaxfonts/mjx-ncm-b.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-b.woff2 new file mode 100644 index 0000000000..09c4a91731 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-b.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-be.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-be.woff2 new file mode 100644 index 0000000000..77d4928237 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-be.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-bi.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-bi.woff2 new file mode 100644 index 0000000000..55b8c15cba Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-bi.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-brk.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-brk.woff2 new file mode 100644 index 0000000000..a000731ab7 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-brk.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-c.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-c.woff2 new file mode 100644 index 0000000000..6223ae548f Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-c.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-cb.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-cb.woff2 new file mode 100644 index 0000000000..b90d1c38b0 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-cb.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-ds.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-ds.woff2 new file mode 100644 index 0000000000..cd4c829cfc Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-ds.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-em.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-em.woff2 new file mode 100644 index 0000000000..292dff939b Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-em.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-f.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-f.woff2 new file mode 100644 index 0000000000..cf97f4c385 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-f.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-fb.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-fb.woff2 new file mode 100644 index 0000000000..2541d9079a Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-fb.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-i.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-i.woff2 new file mode 100644 index 0000000000..75f6419801 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-i.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-lo.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-lo.woff2 new file mode 100644 index 0000000000..2184b929eb Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-lo.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-lt.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-lt.woff2 new file mode 100644 index 0000000000..3b6edfc317 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-lt.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-m.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-m.woff2 new file mode 100644 index 0000000000..020dd9e136 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-m.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-mi.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-mi.woff2 new file mode 100644 index 0000000000..ee69b10c8e Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-mi.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-n.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-n.woff2 new file mode 100644 index 0000000000..9926042f47 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-n.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-ob.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-ob.woff2 new file mode 100644 index 0000000000..d3d0fef17d Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-ob.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-os.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-os.woff2 new file mode 100644 index 0000000000..8d2368a770 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-os.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-rb.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-rb.woff2 new file mode 100644 index 0000000000..cea0352ac4 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-rb.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-s.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-s.woff2 new file mode 100644 index 0000000000..44fad51720 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-s.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-s3.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-s3.woff2 new file mode 100644 index 0000000000..68d14c02fb Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-s3.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-s4.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-s4.woff2 new file mode 100644 index 0000000000..4d49052c5e Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-s4.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-s5.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-s5.woff2 new file mode 100644 index 0000000000..70b92ffa9a Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-s5.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-s6.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-s6.woff2 new file mode 100644 index 0000000000..09ac29f66b Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-s6.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-s7.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-s7.woff2 new file mode 100644 index 0000000000..ca39f6202d Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-s7.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-sb.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-sb.woff2 new file mode 100644 index 0000000000..fc584ba885 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-sb.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-so.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-so.woff2 new file mode 100644 index 0000000000..47548fb591 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-so.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-ss.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-ss.woff2 new file mode 100644 index 0000000000..dd8aa33b74 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-ss.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-ssb.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-ssb.woff2 new file mode 100644 index 0000000000..45176fb12c Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-ssb.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-ssbi.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-ssbi.woff2 new file mode 100644 index 0000000000..358d31ebf8 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-ssbi.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-ssi.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-ssi.woff2 new file mode 100644 index 0000000000..eeab8d11ff Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-ssi.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-u.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-u.woff2 new file mode 100644 index 0000000000..097bcb8e85 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-u.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-ue.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-ue.woff2 new file mode 100644 index 0000000000..6b8ba57019 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-ue.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-v.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-v.woff2 new file mode 100644 index 0000000000..89b6d49609 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-v.woff2 differ diff --git a/webapp/public/mathjaxfonts/mjx-ncm-zero.woff2 b/webapp/public/mathjaxfonts/mjx-ncm-zero.woff2 new file mode 100644 index 0000000000..2fc081c1f5 Binary files /dev/null and b/webapp/public/mathjaxfonts/mjx-ncm-zero.woff2 differ diff --git a/webapp/src/EventListener/AddContentSecurityPolicyListener.php b/webapp/src/EventListener/AddContentSecurityPolicyListener.php index d244aa0796..91e2262076 100644 --- a/webapp/src/EventListener/AddContentSecurityPolicyListener.php +++ b/webapp/src/EventListener/AddContentSecurityPolicyListener.php @@ -17,7 +17,7 @@ public function __invoke(ResponseEvent $event): void // the profiler requires 'unsafe-eval' for script-src 'self'. $response = $event->getResponse(); $cspExtra = $this->profiler ? "'unsafe-eval'" : ""; - $csp = "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' $cspExtra; img-src 'self' data:; worker-src 'self' blob:"; + $csp = "default-src 'self' https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline'; script-src 'self' https://cdn.jsdelivr.net 'unsafe-inline' $cspExtra; img-src 'self' data:; worker-src 'self' blob:"; $response->headers->set('Content-Security-Policy', $csp); } } diff --git a/webapp/templates/base.html.twig b/webapp/templates/base.html.twig index 9b54ed453b..26655e8513 100644 --- a/webapp/templates/base.html.twig +++ b/webapp/templates/base.html.twig @@ -13,6 +13,14 @@ + + {% for file in customAssetFiles('js') %} diff --git a/webapp/templates/jury/menu.html.twig b/webapp/templates/jury/menu.html.twig index 12bddba889..88c96502d7 100644 --- a/webapp/templates/jury/menu.html.twig +++ b/webapp/templates/jury/menu.html.twig @@ -7,6 +7,7 @@ {% set current_route = app.request.attributes.get('_route') %} + Euler's identity: $( e^{i\pi} + 1 = 0 )$