Skip to content

Commit

Permalink
Merge pull request #194 from eeditiones/formula
Browse files Browse the repository at this point in the history
fix(pb-formula): replace XML entities
  • Loading branch information
JoernT authored Dec 12, 2024
2 parents ae476ec + bace492 commit ac1c05e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pb-formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ function _initMath(context, formulas) {
chtml = window.MathJax.mathml2chtml(source, options);
} else {
window.MathJax.texReset();
source = formula.innerHTML;
source = formula.innerHTML.replaceAll(/&\w+;/g, function (m) {
return {
'&': '&',
'&lt;' : '<'
}[m];
});
chtml = window.MathJax.tex2chtml(source, options);
}
formula.innerHTML = '';
Expand Down Expand Up @@ -196,4 +201,4 @@ export class PbFormula extends LitElement {
`;
}
}
customElements.define('pb-formula', PbFormula);
customElements.define('pb-formula', PbFormula);

0 comments on commit ac1c05e

Please sign in to comment.