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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sunt-programator/eleventy-plugin-mathjax

v1.0.1

Published

Eleventy plugin for supporting the MathJax library

Downloads

1

Readme

⚡️ Quick start

Install the plugin by using the following command:

npm install --save-dev @sunt-programator/eleventy-plugin-mathjax

Or use this command in case you are using the Yarn package manager:

yarn add --dev @sunt-programator/eleventy-plugin-mathjax

Next, add this plugin into your Eleventy configuration file (e.g. eleventy.config.js):

const mathjaxPlugin = require("@sunt-programator/eleventy-plugin-mathjax");

module.exports = function (eleventyConfig) {
  eleventyConfig.addPlugin(mathjaxPlugin);
};

🕘 Usage

For a block math, use the $$...$$ notation:

$$
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
$$

This will render to:

$$ x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} $$

For an inline math, use the \\(...\\) notation:

This is an inline math: \\(x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\\).

This will render to:

This is an inline math: $x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$.

🗿 Options

This plugins supports overriding the global options by passing to the addPlugin function an object as a second argument:

// Copy the fonts from node_modules to the output site directory
eleventyConfig.addPassthroughCopy({
  "node_modules/mathjax-full/ts/output/chtml/fonts/tex-woff-v2/": "/fonts/tex-woff-v2/",
});

// Use the fonts to render the glyphs in CommonHTML mode
eleventyConfig.addPlugin(mathjaxPlugin, {
  chtml: {
    fontURL: "/fonts/tex-woff-v2",
  },
});

The global options used by this plugin look like this:

const globalOptions = {
  inputFormat: "tex",
  outputFormat: "chtml",
  asciimath: { delimiters: [["\\(", "\\)"]] },
  mml: {},
  tex: {
    packages: AllPackages,
  },
  svg: {},
  chtml: {},
  liteAdaptor: {},
  useAssistiveMml: true,
};

| Option | Description | --- | --- | | inputFormat | The math format of the input. Accepts tex, asciimath or mml. Default: tex. | | outputFormat | The math format of the produced output. Acceps chtml or svg. Default: chtml. | | asciimath | The AsciiMath configuration options. Valid if the inputFormat is set to asciimath. | | tex | The TeX configuration options. Valid if the inputFormat is set to tex. | | mml | The MathML configuration options. Valid if the inputFormat is set to mml. | | svg | The SVG configuration options. Valid if the outputFormat is set to svg. | | chtml | The CommonHTML configuration options. Valid if the outputFormat is set to chtml. | | liteAdaptor | The Lite Adaptor configuration options. | | useAssistiveMml | The flag indicating whether to use the assistive MathML. |

💡 Inspiration

This plugin used two repos as an inspiration:

  1. MathJax Node Demos - Integration with MathJax
  2. eleventy-plugin-mathjax by Tsung-Ju Chiang - Plugin implementation
  3. Angular - Community Standards files

📰 License

This plugin is MIT licensed.