forked from gohugoio/hugoDocs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: transform.ToMath | ||
description: Renders a math expression using KaTeX. | ||
categories: [] | ||
keywords: [] | ||
action: | ||
aliases: [] | ||
related: | ||
- content-management/mathematics | ||
returnType: template.HTML | ||
signatures: ['transform.ToMath EXPRESSION [OPTIONS]'] | ||
aliases: [/functions/tomath] | ||
toc: true | ||
--- | ||
|
||
{{< new-in "0.132.0" >}} | ||
|
||
{{% note %}} | ||
This feature was introduced in Hugo 0.132.0 and is marked as experimental. | ||
|
||
This does not mean that it's going to be removed, but this is our first use of WASI/Wasm in Hugo, and need to see how it [works in the wild](https://github.com/gohugoio/hugo/issues/12736) before we can set it in stone. | ||
{{% /note %}} | ||
|
||
## Arguments | ||
|
||
EXPRESSION | ||
: The math expression to render using KaTeX. | ||
|
||
OPTIONS | ||
: A map of zero or more [options]. | ||
|
||
## Options | ||
|
||
These are a sub set of the [KaTeX options]. | ||
|
||
output | ||
: String. Default is `mathml`.\ | ||
`html` Outputs HTML only.\ | ||
`mathml`: Outputs MathML only.\ | ||
`htmlAndMathml`: Outputs HTML for visual rendering and MathML for accessibility. | ||
|
||
displayMode | ||
: Boolean. Default is `false`.\ | ||
If `true` the math will be rendered in display mode. If false the math will be rendered in `inline` mode. | ||
|
||
throwOnError | ||
: Boolean. Default is `false`.\ | ||
If `true` KaTeX will throw a `ParseError` when it encounters an unsupported command.\ | ||
|
||
|
||
## Examples | ||
|
||
```go-html-template | ||
{{ transform.ToMath "c = \\pm\\sqrt{a^2 + b^2}" }} | ||
``` | ||
|
||
[options]: #options | ||
[KaTeX options]: https://katex.org/docs/options.html | ||
|
||
|
||
|