
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
hexo-filter-tikzjax
Advanced tools
Server side PGF/TikZ renderer plugin for Hexo.
Render graphs, figures, circuits, chemical diagrams, commutative diagrams, and more in your blog posts.
No client side JavaScript required. Woo-hoo! 🎉
npm install hexo-filter-tikzjax
For the first run after installation, you need to run hexo clean
to clean the cache.
Configure this plugin in your site's _config.yml
. Default values:
tikzjax:
# Enable TikZ rendering for all posts and pages.
# Or you can enable it per post by adding `tikzjax: true` to the front-matter.
every_page: false
# Add CSS to pages which contain TikZ graphs.
append_css: true
# URL of the font CSS file.
font_css_url: 'https://cdn.jsdelivr.net/npm/node-tikzjax@latest/css/fonts.css'
# Additional options that will be passed to node-tikzjax.
# See: https://github.com/prinsss/node-tikzjax/#usage
# tikzjax_options:
# showConsole: false
Add tikzjax: true
to the front-matter of posts/pages that you would like to enable TikZ rendering.
Wrap you TikZ code in a Markdown code block with language tikz
, and you are good to go!
```tikz
\begin{document}
\begin{tikzpicture}
% Your code here...
\end{tikzpicture}
\end{document}
```
TikZ code are rendered as static SVG images during the Hexo generation process. The SVG images are then embedded into the HTML pages so there is no client side JavaScript involved. The images will be updated automatically when you change the code.
For a full list of supported TikZ features and $\LaTeX$ packages, please refer to the node-tikzjax documentation.
[!TIP] Run
hexo generate
orhexo server
with--debug
option to see the debug messages, including the console output of the TeX engine. To clear the internal SVG cache, runrm -rf node_modules/hexo-filter-tikzjax/.cache
.
As this plugin is greatly inspired by obsidian-tikzjax, you can expect the same syntax, features and rendering results.
---
title: 'Lorem Ipsum'
date: '2024/01/01 11:45:14'
mathjax: true
tikzjax: true
---
We love using $\LaTeX$ and Ti*k*Z in [Hexo](http://hexo.io)!
```tikz
\begin{document}
\begin{tikzpicture}[domain=0:4,scale=1.1]
\draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
\draw[color=red] plot (\x,\x) node[right] {$f(x) =x$};
\draw[color=blue] plot (\x,{sin(\x r)}) node[right] {$f(x) = \sin x$};
\draw[color=orange] plot (\x,{0.05*exp(\x)}) node[right] {$f(x) = \frac{1}{20} \mathrm e^x$};
\end{tikzpicture}
\end{document}
```
The above code will be rendered and embedded as an inline SVG image.
For more examples, please refer to the node-tikzjax.
FAQs
Server side PGF/TikZ renderer plugin for Hexo.
We found that hexo-filter-tikzjax demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.