Hyperlink in KaTeX

How would the word ‘line’ be hyperlinked in the following syntax for a cell using Mathematical Formula for its cell mode?:

\text{slope of line} = \frac{f(x_0+h)-f(x_0)}{h}

It looks like \href is disabled. See: Supported Functions · KaTeX

You can use tex.options for this, like so:

tex.options({trust: true})`\text{slope of \href{https://example.com}{line}} = \frac{f(x_0+h)-f(x_0)}{h}`

Notebook: KaTeX options example / Observable | Observable

2 Likes

Follow-up:

To get the equivalent display mode that the Mathematical Formula cell uses:

tex.options({
trust: true,
displayMode: true
})\text{slope of \href{https://example.com}{line}} = \frac{f(x_0+h)-f(x_0)}{h}