Skip to content

Commit

Permalink
feat: add nodeClassName Option
Browse files Browse the repository at this point in the history
  • Loading branch information
Dup4 committed Jun 2, 2022
1 parent ff00efa commit 4776c55
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/mathjax-render/src/browser/Tex2SVG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,20 @@ const mathDocument = mathjax.document(document, {
// Add CSS styles
mathDocument.updateDocument();

export function Tex2SVG(math: string, display: boolean) {
export interface Options {
nodeClassName?: string;
}

export function Tex2SVG(math: string, display: boolean, options?: Options) {
try {
const wrapper = mathDocument.convert(math, {
display,
});

if (options?.nodeClassName) {
wrapper.classList.replace("MathJax", options.nodeClassName);
}

const title = document.createElement("title");
title.innerText = math;

Expand Down

0 comments on commit 4776c55

Please sign in to comment.