Skip to content

Commit

Permalink
feat: add errorMessageClassNameList
Browse files Browse the repository at this point in the history
  • Loading branch information
Dup4 committed Jun 3, 2022
1 parent ea5578e commit f78af95
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/mathjax-render/src/browser/Tex2SVG.ts
Expand Up @@ -22,6 +22,7 @@ mathDocument.updateDocument();

export interface Options {
nodeClassNameList?: string[];
errorMessageClassNameList?: string[];
}

export function Tex2SVG(math: string, display: boolean, options?: Options) {
Expand Down Expand Up @@ -53,11 +54,16 @@ export function Tex2SVG(math: string, display: boolean, options?: Options) {

const message = document.createElement("span");
message.innerText = GenerateErrorMessage(math, display, GetErrorMessage(e));
message.style.fontWeight = "bold";
message.style.display = "inline-block";
message.style.border = "2px solid #000";
message.style.padding = "0 4px";
message.style.textAlign = "left";

if (options?.errorMessageClassNameList) {
message.classList.add(...options.errorMessageClassNameList);
} else {
message.style.fontWeight = "bold";
message.style.display = "inline-block";
message.style.border = "2px solid #000";
message.style.padding = "0 4px";
message.style.textAlign = "left";
}

wrapper.appendChild(message);
return wrapper;
Expand Down

0 comments on commit f78af95

Please sign in to comment.