File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @openstax/highlighter" ,
3- "version" : " 1.16.1 " ,
3+ "version" : " 1.16.2 " ,
44 "main" : " dist/index.js" ,
55 "license" : " MIT" ,
66 "files" : [
Original file line number Diff line number Diff line change @@ -7,14 +7,21 @@ export const rangeContentsString = (range: Range): string => {
77 const removeAll = ( nodes : NodeListOf < Element > ) => nodes . forEach ( ( element : Element ) => element . remove ( ) ) ;
88
99 container . appendChild ( fragment ) ;
10- // MathJax 2
10+ // REX creates math/mml script tags inside mjx-container elements for MathJax 4.
11+ // Timing issues prevent placing them outside like MathJax 2 used to do,
12+ // so we need to move them to match the MathJax 2 location.
13+ const mjxContainers = container . querySelectorAll ( 'mjx-container' ) ;
14+ mjxContainers . forEach ( ( mjxContainer : Element ) => {
15+ const scriptTag = mjxContainer . querySelector ( 'script[type="math/mml"]' ) ;
16+ if ( scriptTag && mjxContainer . parentElement ) {
17+ mjxContainer . parentElement . insertBefore ( scriptTag , mjxContainer ) ;
18+ }
19+ } ) ;
20+
1121 removeAll ( container . querySelectorAll ( '.MathJax' ) ) ;
1222 removeAll ( container . querySelectorAll ( '.MathJax_Display' ) ) ;
1323 removeAll ( container . querySelectorAll ( '.MathJax_Preview' ) ) ;
1424 removeAll ( container . querySelectorAll ( '.MJX_Assistive_MathML' ) ) ;
15- // MathJax 4
16- removeAll ( container . querySelectorAll ( 'mjx-container' ) ) ;
17-
1825 removeAllHighlights ( container ) ;
1926
2027 container . querySelectorAll ( 'script[type="math/mml"]' ) . forEach ( ( element : Element ) => {
You can’t perform that action at this time.
0 commit comments