feat: auto-load KaTeX's mchecm extension

This commit is contained in:
welpo 2026-01-01 23:17:12 +01:00
parent d617318ae6
commit d365132ba3
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6
7 changed files with 65 additions and 14 deletions

View file

@ -46,6 +46,10 @@
{%- if macros_settings::evaluate_setting_priority(setting="katex", page=page_s, section=section_s, default_global_value=false) == "true" -%}
<link rel="stylesheet" href="{{ get_url(path='katex.min.css', trailing_slash=false) | safe }}">
<script defer src="{{ get_url(path='js/katex.min.js', trailing_slash=false) | safe }}"></script>
{# Load mhchem extension if chemistry formulas detected #}
{%- if page and page.content and ("\ce{" in page.content or "\pu{" in page.content) -%}
<script defer src="{{ get_url(path='js/mhchem.min.js', trailing_slash=false) | safe }}"></script>
{%- endif -%}
{%- endif -%}
{# Load mermaid.js #}