site/node_modules/rehype-mathjax/lib/svg.js

20 lines
554 B
JavaScript
Raw Permalink Normal View History

2024-10-14 06:09:33 +00:00
import {SVG} from 'mathjax-full/js/output/svg.js'
import {createPlugin} from './create-plugin.js'
import {createRenderer} from './create-renderer.js'
/**
* Render elements with a `language-math` (or `math-display`, `math-inline`)
* class with MathJax using SVG.
*
* @param [options]
* Configuration (optional).
* @returns
* Transform.
*/
const rehypeMathJaxSvg = createPlugin(function (options) {
// MathJax types do not allow `null`.
return createRenderer(options, new SVG(options.svg || undefined))
})
export default rehypeMathJaxSvg