Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment support Katex #1490

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -895,11 +895,15 @@ vendors:
mathjax:

# KaTeX
# katex: //cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css
# katex: //cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css
# katex_css: //cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css
# katex_css: //cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css
# katex_js: //cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js
# autorender_js: //cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js
# copy_tex_js: //cdn.jsdelivr.net/npm/katex@0/dist/contrib/copy-tex.min.js
# copy_tex_css: //cdn.jsdelivr.net/npm/katex@0/dist/contrib/copy-tex.min.css
katex:
katex_css:
Katex_js:
autorender_js:
copy_tex_js:
copy_tex_css:

Expand Down
7 changes: 7 additions & 0 deletions layout/_partials/head/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,11 @@
<script src="{{ pace_js_uri }}"></script>
{%- endif %}

{%- if not theme.math.per_page or is_index_has_math or page.mathjax %}
{%- if theme.math.katex %}
{%- set autorender_js_uri = next_vendors('//cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js') %}
<script defer src="{{ autorender_js_uri }}" onload="renderMathInElement(document.body);"></script>
{%- endif %}
{%- endif %}

{{ next_config() }}
6 changes: 4 additions & 2 deletions layout/_third-party/math/katex.swig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{%- set katex_uri = theme.vendors.katex or '//cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css' %}
<link rel="stylesheet" href="{{ katex_uri }}">
{%- set katex_css_uri = theme.vendors.katex_css or next_vendors('//cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css') %}
{%- set katex_js_uri = theme.vendors.katex_js or next_vendors('//cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js') %}
<link rel="stylesheet" href="{{ katex_css_uri }}">
<script src="{{ katex_js_uri }}"></script>
{%- if theme.math.katex.copy_tex %}
{%- set copy_tex_js_uri = theme.vendors.copy_tex_js or '//cdn.jsdelivr.net/npm/katex@0/dist/contrib/copy-tex.min.js' %}
{%- set copy_tex_css_uri = theme.vendors.copy_tex_css or '//cdn.jsdelivr.net/npm/katex@0/dist/contrib/copy-tex.min.css' %}
Expand Down