npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@planktimerr/tikzjax

v1.0.8

Published

TikZJax loader

Readme

TikZJax

TikZJax converts <script> tags (containing TikZ code) into SVGs.

See a live demo at tikzjax.com.

Note that the demo above is not the same as what you will get from what this branch of my fork. However, it does show the general concept.

This is a fork of Glenn Rice's (drgrice1) work with fixes and improvements to enhance compatibility and functionality.

Thanks to Jim Fowler for doing all of the hard work. See kisonecat/tikzjax, kisonecat/web2js, and kisonecat/dvi2html for his original work.

Also see jhoobergs/web2js for additional changes that were made by Jesse Hoobergs that were used in this work.

Installation

In the <head> of your HTML, include the following CDN links:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@planktimerr/[email protected]/dist/fonts.css">
<script src="https://cdn.jsdelivr.net/npm/@planktimerr/[email protected]/dist/tikzjax.js"></script>

Example

Then in the <body>, include TikZ code such as

<script type="text/tikz">
 \begin{tikzpicture}
 \draw (0,0) circle (1in);
 \end{tikzpicture}
</script>

The TikZ code will be compiled into an SVG image, and the <script> element will be replaced with the generated SVG image.

Options

There are several data attributes that can be set for a "text/tikz" <script> tag that affect the generation of the resulting SVG image, or change the way the TikzJax javascript behaves.

The values of the data-width and data-height attributes set on the <script> tag will be used for the width and height of a loader image. This is an svg image that is displayed while TeX is being run to generate the svg image, and contains a spinner to indicate to the user that work is being done. These dimensions are in points.

Use data-tex-packages to load and use TeX packages. The value of this attribute must be a string that will parse to a valid javascript object via the javascript JSON.parse method. The keys of the object should be the TeX package names, and the value of each key should be the package options to set. For example:

<script type="text/tikz" data-tex-packages='{ "array": "", "pgfplots": "", "custom-package": "option=special" }'>

will add

\usepackage{array}
\usepackage{pgfplots}
\usepackage[option=special]{custom-package}

to the preamble of the TeX input. Note that TeX packages must be loaded in this way. This will ensure that the needed TeX system files are made available to the TeX WebAssembly for successful compilation. Note that the TeX packages that are available at this time are amsbsy, amsfonts, amsgen, amsmath, amsopn, amssymb, amstext, array, etoolbox, hf-tikz, pgfplots, tikz-3dplot, tikz-cd, and xparse. Additional packages can be made available by adding the gzipped TeX files used by the package to the tex_files directory.

Use data-tikz-libraries to load and use TikZ libraries. For example:

<script type="text/tikz" data-tikz-libraries="arrows.meta,calc">

will result in

\usetikzlibrary{arrows.meta,calc}

being added to the preamble of the TeX input. As with TeX packages, TikZ libraries must be loaded in this way to ensure that the needed TeX system files are made available to the TeX WebAssembly for successful compilation. Note that all known TikZ libraries are available (with the exception of some that don't make sense in this context, like the external library).

Use data-add-to-preamble="..." to add to the TeX preamble.

An SVG title can be added for screen reader users by setting data-aria-label.

The data-disable-cache attribute can be set to true to disable caching of an image in the indexed database.

Use data-show-console="true" to enable the output of TeX in the console. By default, console output is disabled and nothing is shown in the browser console.

CSS Classes

For your convenience, some css classes are provided that will apply common styles to the svg image. To use these classes place the "text/tikz" script tags inside an html element with one of the following classes.

If you add the css class tikzjax-container to the containing element, then overflow:visible will be added to the style of the generated <svg> image.

If you add the css class tikzjax-scaled-container to the containing element, then overflow:visible, width:100%, and height:100% will be added to the style of the generated <svg> image.

Other JavaScript Interactions

Note that once tikzjax completes the generation of an SVG image, the generated <svg> image will emit the tikzjax-load-finished event. You can use this event to do something with the generated SVG image in javascript.

For example:

document.addEventListener('tikzjax-load-finished', function(e) {
    var svg = e.srcElement;
    ...
});

Additionally, during the processing of TikZ code, a tikzjax-tex-input event is emitted that contains the complete TeX input used to generate the image. This can be useful for debugging or for showing the full TeX code to users.

document.addEventListener('tikzjax-tex-input', function(e) {
    var texInput = e.detail.input;
    // texInput contains the complete TeX code including preamble
    ...
});