~fd/grav-plugin-staticmath

Render LaTeX in Grav without Javascript

23d3441 Update README

27 days ago

4878e1b Formatting

a month ago

#Grav StaticMath Plugin

The StaticMath Plugin is an extension for Grav CMS. This plugin converts LaTeX to static math (with some CSS) using server-side Temml.

#Installation

Installing the StaticMath plugin can be done in one of three ways: The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command, the manual method lets you do so via a zip file, and the admin method lets you do so via the Admin Plugin.

#Server (Required)

Install the StaticMath server first.

#GPM Installation (Preferred)

To install the plugin via the GPM, through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:

bin/gpm install staticmath

This will install the staticmath plugin into your /user/plugins-directory within Grav. Its files can be found under /your/site/grav/user/plugins/staticmath.

#Manual Installation

To install the plugin manually, download the zip-version of this repository and unzip it under /your/site/grav/user/plugins. Then rename the folder to staticmath. You can find these files on GitHub or via GetGrav.org.

You should now have all the plugin files under

/your/site/grav/user/plugins/staticmath
	

#Admin Plugin

If you use the Admin Plugin, you can install the plugin directly by browsing the Plugins-menu and clicking on the Add button.

#Configuration

Before configuring this plugin, you should copy the user/plugins/staticmath/staticmath.yaml to user/config/plugins/staticmath.yaml and only edit that copy.

Here is the default configuration and an explanation of available options:

built_in_css: true # Uses built-in Temml CSS
server: "http://localhost:3000" # The location of the StaticMath server

Note that if you use the Admin Plugin, a file with your configuration named staticmath.yaml will be saved in the user/config/plugins/-folder once the configuration is saved in the Admin.

#Usage

Wherever you want LaTeX code in your server, use the delimiters set in the configuration, like so:

$$
\text{This is a block of LaTeX code}
$$

And $\text{this}$ is inline LaTeX code.

#Credits

Much thanks to Temml for rendering the math, the Grav MathJax Plugin for giving me a base to build off of, and the Grav ZMarkdown Plugin to give me pointers for how to do networking in PHP.

The Latin Modern Math WOFF2 file is from the MathFonts repository, under the MPL2.0 license license.