A custom element wrapper around temml
npm install temml-custom-element> A Custom element wrapper around [Temml][temml]
This library provides two custom elements and to include LaTeX expressions in your HTML document
but display the math equation.
``bash`
npm install --save temml temml-custom-element
You may also want to download a math font.
`js`
import "temml-custom-element";
`html
\def\E{\mathbb{E}}
\newcommand\d[0]{\operatorname{d}\!}
\E[X] = \int_{-\infty}^{\infty} xf(x) \d{x}
`
If you want to register the custom elements under different names the
classes are available as seperate modules:
`js
import LaTexElement from "temml-custom-element/la-tex-element.js";
import LaTexPreampleElement from "temml-custom-element/la-tex-preample-element.js";
customElements.define("temml-math", LaTexElement);
customElements.define("temml-preample", LaTexPreampleElement);
`
Download (or link to) the module assets. Note that if you are using
the unbundled module you have to add temml as a peer dependency in the
import map (under scopes in the example below). If you are using thescopes
bundled module you can omit the below.
Replace /path/to with the location of the modules.
`html
`
parses its own text content and renders it to a
[MathML][mathml] markup which the browser understands and will display
the equation.
#### Slots
- default: The LaTeX expression.
#### Attributes and properties
All available [options][temml#options] to temml.render are reflecteddisplayMode
as both properties and attributes except , errorColorxml
and , with the additional:
- display: Either block or inline (defaults to inline). Passblock
if you want to render with displayMode: true.macros
- : Just the string persist (defaults to nothing). Passpersist
if you want to either:
- Use macros defined in or with \gdef\gdef
- Define a new macro with to be used by other trust
instances.
- is a boolean attribute or a function property reflecting
the same temml option.
#### CSS Shadow Parts
- math: The rendered
#### CSS Custom Properties
- --la-tex-error-color: The color of error text (both failed
commands and ::part(error)). Same as the errorColor option to temml
render.
An invissible element that won’t render any content. Used to define
macros and colors for la-tex elements with .
#### Slots
- default: The macro definitions to be used in
elements.
[temml]: https://temml.org/
[temml#options]: https://temml.org/docs/en/administration#options
[mathml]: https://developer.mozilla.org/en-US/docs/Web/MathML