next-theme / hexo-filter-mathjax

💯 Server side MathJax renderer plugin for Hexo.
https://www.npmjs.com/package/hexo-filter-mathjax
MIT License
105 stars 6 forks source link

tikzjax #56

Closed mathirst closed 6 months ago

mathirst commented 1 year ago

Hello,

Thanks for your nice plug-in. I am wondering whether it could support tikzjax or not. If so, how to make it?

stevenjoezhang commented 1 year ago

Do you mean this tikzjax: https://github.com/kisonecat/tikzjax I'm afraid it may not be supported. TikZJax is TikZ running under WebAssembly in the browser, but this plugin runs server-side. See also https://github.com/mathjax/MathJax/issues/41

mathirst commented 1 year ago

Do you mean this tikzjax: https://github.com/kisonecat/tikzjax I'm afraid it may not be supported. TikZJax is TikZ running under WebAssembly in the browser, but this plugin runs server-side. See also mathjax/MathJax#41

I see. Thank you!

stevenjoezhang commented 1 year ago

And, you can try to use tikzjax like this in Hexo:

---
title: LaTeX demo
date: 2022-11-22 16:33:13
mathjax: true
---

<link rel="stylesheet" type="text/css" href="https://tikzjax.com/v1/fonts.css">
<script src="https://tikzjax.com/v1/tikzjax.js"></script>
<script type="text/tikz">
  \begin{tikzpicture}
    \draw (0,0) circle (1in);
  \end{tikzpicture}
</script>

this plugin won't render math formulas inside <script> tag, so the front-end script of tikzjax can handle them when users open the webpage

prinsss commented 8 months ago

In case anyone is still interested in using TikZJax in Hexo, I have created a new plugin for server side TikZ rendering, which internally runs TikZJax on Node.js.

See: hexo-filter-tikzjax

stevenjoezhang commented 6 months ago

@prinsss Is hexo-filter-tikzjax compatible with hexo-filter-mathjax? I can add a link in README

prinsss commented 6 months ago

@prinsss Is hexo-filter-tikzjax compatible with hexo-filter-mathjax? I can add a link in README

Yes, it is. Here is a working demo: StackBlitz.

I'm using hexo-filter-mathjax + hexo-filter-tikzjax + pandoc in my own blog and it works pretty well. It would be appreciated if this could help more people with similar needs. :)