mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Improve MathJax filtering of font-family attribute (#18819)
GitOrigin-RevId: 04460c9549c33dbf76efba0e72bed8694072de9d
This commit is contained in:
parent
d3c270369d
commit
4971afd527
1 changed files with 13 additions and 1 deletions
|
@ -40,7 +40,6 @@ export const loadMathJax = async (options?: {
|
|||
'[-]': [
|
||||
'html', // avoid creating HTML elements/attributes
|
||||
'require', // prevent loading disabled packages
|
||||
'unicode', // Prevent CSS injection https://github.com/mathjax/MathJax/issues/3129 / https://github.com/mathjax/MathJax/issues/3241
|
||||
],
|
||||
},
|
||||
processEscapes: true,
|
||||
|
@ -65,6 +64,19 @@ export const loadMathJax = async (options?: {
|
|||
.findID('Renderer')
|
||||
.disable()
|
||||
},
|
||||
ready() {
|
||||
window.MathJax.startup.defaultReady()
|
||||
|
||||
// remove anything from the "font-family" attribute after a semicolon
|
||||
// so it's not added to the style attribute
|
||||
// https://github.com/mathjax/MathJax/issues/3129#issuecomment-1807225345
|
||||
const { safe } = window.MathJax.startup.document
|
||||
safe.filterAttributes.set('fontfamily', 'filterFontFamily')
|
||||
safe.filterMethods.filterFontFamily = (
|
||||
_safe: any,
|
||||
family: string
|
||||
) => family.split(/;/)[0]
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue