Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hexo-filter-tikzjax

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-filter-tikzjax

Server side PGF/TikZ renderer plugin for Hexo.

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
23
decreased by-17.86%
Maintainers
1
Weekly downloads
 
Created
Source

hexo-filter-tikzjax

Latest Version License

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! 🎉

Installation

npm install hexo-filter-tikzjax

For the first run after installation, you need to run hexo clean to clean the cache.

Configuration

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

Usage

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 or hexo server with --debug option to see the debug messages, including the console output of the TeX engine. To clear the internal SVG cache, run rm -rf node_modules/hexo-filter-tikzjax/.cache.

Example

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.

01-post-render

License

MIT

FAQs

Package last updated on 16 Jan 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc