Svelte component to render Djot markup, with math rendered into MathML via Temml
npm install svelte-djot-math> A Svelte component to render Djot markup, with math rendered into MathML via Temml.
``bashusing pnpm
pnpm i -D svelte-djot-math
$3
`svelte
`$3
For the best math rendering, include a temml css and font file when using the component. See the temml docs for more details.
Usage
$3
`svelte
We can use slots. Inline math in Djot has the $x syntax. We only recommend this for short
strings due to how whitespace is handled in HTML.
`$3
`svelte
`$3
`svelte
This will not be rendered.
`$3
We also support the "$" delimiters commonly used in LaTeX.
Markup like \$x\$ and \$\$x\$\$ will be transformed into Djot syntax and
rendered into HTML accordingly. This also means that you will need to
_escape_ regular dollar signs in your markup.
This is done by the
transform function, which can be customized by passing
your own transform function as an option.Options
You can pass a custom
transform function with type
(x: string) => string to customize how your markup
is handled before it is fed to the djot parser.You can also pass options for the djot parser, the djot renderer (and overrides), and the temml renderer. These are optional props for the component.
`svelte
{transform}
{djotParseOptions}
{djotHTMLRenderOptions}
{overrides}
{temmlOptions}
>
``