@pie-lib/math-rendering-accessible 3.22.2-next.11 → 3.22.2-next.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,137 +7,75 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
7
7
 
8
8
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
9
9
 
10
-
11
-
12
-
13
-
14
10
  # [3.22.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.21.0...@pie-lib/math-rendering-accessible@3.22.0) (2025-10-16)
15
11
 
16
12
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
17
13
 
18
-
19
-
20
-
21
-
22
14
  # [3.21.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.18.0...@pie-lib/math-rendering-accessible@3.21.0) (2025-10-16)
23
15
 
24
16
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
25
17
 
26
-
27
-
28
-
29
-
30
18
  # [3.20.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.18.0...@pie-lib/math-rendering-accessible@3.20.0) (2025-10-16)
31
19
 
32
20
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
33
21
 
34
-
35
-
36
-
37
-
38
22
  # [3.19.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.18.0...@pie-lib/math-rendering-accessible@3.19.0) (2025-10-16)
39
23
 
40
24
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
41
25
 
42
-
43
-
44
-
45
-
46
26
  ## [3.18.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.18.0...@pie-lib/math-rendering-accessible@3.18.1) (2025-10-14)
47
27
 
48
28
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
49
29
 
50
-
51
-
52
-
53
-
54
30
  # 3.18.0 (2025-09-25)
55
31
 
56
-
57
32
  ### Bug Fixes
58
33
 
59
- * fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
60
-
34
+ - fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
61
35
 
62
36
  ### Features
63
37
 
64
- * split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
65
-
66
-
67
-
68
-
38
+ - split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
69
39
 
70
40
  # [3.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.16.0...@pie-lib/math-rendering-accessible@3.17.0) (2025-09-18)
71
41
 
72
42
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
73
43
 
74
-
75
-
76
-
77
-
78
44
  # [3.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.15.0...@pie-lib/math-rendering-accessible@3.16.0) (2025-09-18)
79
45
 
80
46
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
81
47
 
82
-
83
-
84
-
85
-
86
48
  # 3.15.0 (2025-09-18)
87
49
 
88
-
89
50
  ### Bug Fixes
90
51
 
91
- * fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
92
-
52
+ - fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
93
53
 
94
54
  ### Features
95
55
 
96
- * split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
97
-
98
-
99
-
100
-
56
+ - split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
101
57
 
102
58
  # [3.14.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.13.0...@pie-lib/math-rendering-accessible@3.14.0) (2025-09-17)
103
59
 
104
60
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
105
61
 
106
-
107
-
108
-
109
-
110
62
  # [3.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.12.0...@pie-lib/math-rendering-accessible@3.13.0) (2025-09-17)
111
63
 
112
64
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
113
65
 
114
-
115
-
116
-
117
-
118
66
  # [3.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering-accessible@3.11.1...@pie-lib/math-rendering-accessible@3.12.0) (2025-09-17)
119
67
 
120
68
  **Note:** Version bump only for package @pie-lib/math-rendering-accessible
121
69
 
122
-
123
-
124
-
125
-
126
70
  ## 3.11.1 (2025-08-11)
127
71
 
128
-
129
72
  ### Bug Fixes
130
73
 
131
- * fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
132
-
74
+ - fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
133
75
 
134
76
  ### Features
135
77
 
136
- * split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
137
-
138
-
139
-
140
-
78
+ - split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
141
79
 
142
80
  # 3.11.0 (2025-08-07)
143
81
 
package/esm/index.js CHANGED
@@ -12,60 +12,47 @@ const PAIRS = {
12
12
  const wrapMath = (content, wrapType) => {
13
13
  if (wrapType === BracketTypes.SQUARE_BRACKETS) {
14
14
  console.warn('\\[...\\] is not supported yet'); // eslint-disable-line
15
-
16
15
  wrapType = BracketTypes.ROUND_BRACKETS;
17
16
  }
18
-
19
17
  if (wrapType === BracketTypes.DOUBLE_DOLLAR) {
20
18
  console.warn('$$...$$ is not supported yet'); // eslint-disable-line
21
-
22
19
  wrapType = BracketTypes.DOLLAR;
23
20
  }
24
-
25
21
  const [start, end] = PAIRS[wrapType] || PAIRS[BracketTypes.ROUND_BRACKETS];
26
22
  return `${start}${content}${end}`;
27
23
  };
28
24
  const unWrapMath = content => {
29
25
  const displayStyleIndex = content.indexOf('\\displaystyle');
30
-
31
26
  if (displayStyleIndex !== -1) {
32
27
  console.warn('\\displaystyle is not supported - removing'); // eslint-disable-line
33
-
34
28
  content = content.replace('\\displaystyle', '').trim();
35
29
  }
36
-
37
30
  if (content.startsWith('$$') && content.endsWith('$$')) {
38
31
  console.warn('$$ syntax is not yet supported'); // eslint-disable-line
39
-
40
32
  return {
41
33
  unwrapped: content.substring(2, content.length - 2),
42
34
  wrapType: BracketTypes.DOLLAR
43
35
  };
44
36
  }
45
-
46
37
  if (content.startsWith('$') && content.endsWith('$')) {
47
38
  return {
48
39
  unwrapped: content.substring(1, content.length - 1),
49
40
  wrapType: BracketTypes.DOLLAR
50
41
  };
51
42
  }
52
-
53
43
  if (content.startsWith('\\[') && content.endsWith('\\]')) {
54
44
  console.warn('\\[..\\] syntax is not yet supported'); // eslint-disable-line
55
-
56
45
  return {
57
46
  unwrapped: content.substring(2, content.length - 2),
58
47
  wrapType: BracketTypes.ROUND_BRACKETS
59
48
  };
60
49
  }
61
-
62
50
  if (content.startsWith('\\(') && content.endsWith('\\)')) {
63
51
  return {
64
52
  unwrapped: content.substring(2, content.length - 2),
65
53
  wrapType: BracketTypes.ROUND_BRACKETS
66
54
  };
67
55
  }
68
-
69
56
  return {
70
57
  unwrapped: content,
71
58
  wrapType: BracketTypes.ROUND_BRACKETS
@@ -6859,10 +6846,9 @@ function requireTexError () {
6859
6846
  var TexErrorExports = requireTexError();
6860
6847
  var TexError = /*@__PURE__*/getDefaultExportFromCjs(TexErrorExports);
6861
6848
 
6849
+ /* global MathJax */
6862
6850
  const visitor = new SerializedMmlVisitorExports.SerializedMmlVisitor();
6863
-
6864
6851
  const toMMl = node => visitor.visitTree(node);
6865
-
6866
6852
  const NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
6867
6853
  const NEWLINE_LATEX = '\\newline ';
6868
6854
  const mathRenderingKEY = '@pie-lib/math-rendering@2';
@@ -6880,7 +6866,6 @@ const getGlobal = () => {
6880
6866
  if (!window[mathRenderingAccessibleKEY]) {
6881
6867
  window[mathRenderingAccessibleKEY] = {};
6882
6868
  }
6883
-
6884
6869
  return window[mathRenderingAccessibleKEY];
6885
6870
  } else {
6886
6871
  return {};
@@ -6890,17 +6875,14 @@ const fixMathElement = element => {
6890
6875
  if (element.dataset.mathHandled) {
6891
6876
  return;
6892
6877
  }
6893
-
6894
6878
  let property = 'innerText';
6895
-
6896
6879
  if (element.textContent) {
6897
6880
  property = 'textContent';
6898
6881
  }
6899
-
6900
6882
  if (element[property]) {
6901
- element[property] = wrapMath(unWrapMath(element[property]).unwrapped); // because mathquill doesn't understand line breaks, sometimes we end up with custom elements on prompts/rationale/etc.
6883
+ element[property] = wrapMath(unWrapMath(element[property]).unwrapped);
6884
+ // because mathquill doesn't understand line breaks, sometimes we end up with custom elements on prompts/rationale/etc.
6902
6885
  // we need to replace the custom embedded elements with valid latex that Mathjax can understand
6903
-
6904
6886
  element[property] = element[property].replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX);
6905
6887
  element.dataset.mathHandled = true;
6906
6888
  }
@@ -6909,48 +6891,40 @@ const fixMathElements = (el = document) => {
6909
6891
  const mathElements = el.querySelectorAll('[data-latex]');
6910
6892
  mathElements.forEach(item => fixMathElement(item));
6911
6893
  };
6912
-
6913
6894
  const adjustMathMLStyle = (el = document) => {
6914
6895
  const nodes = el.querySelectorAll('math');
6915
6896
  nodes.forEach(node => node.setAttribute('displaystyle', 'true'));
6916
6897
  };
6917
-
6918
6898
  const createPlaceholder = element => {
6919
6899
  var _element$previousSibl;
6920
-
6921
6900
  if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) != null && _element$previousSibl.contains('math-placeholder'))) {
6922
6901
  var _element$parentNode;
6923
-
6924
6902
  // Store the original display style before setting it to 'none'
6925
6903
  element.dataset.originalDisplay = element.style.display || '';
6926
6904
  element.style.display = 'none';
6927
6905
  const placeholder = document.createElement('span');
6928
6906
  placeholder.style.cssText = 'height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;';
6929
6907
  placeholder.classList.add('math-placeholder');
6930
- (_element$parentNode = element.parentNode) == null ? void 0 : _element$parentNode.insertBefore(placeholder, element);
6908
+ (_element$parentNode = element.parentNode) == null || _element$parentNode.insertBefore(placeholder, element);
6931
6909
  }
6932
6910
  };
6933
-
6934
6911
  const removePlaceholdersAndRestoreDisplay = () => {
6935
6912
  document.querySelectorAll('.math-placeholder').forEach(placeholder => {
6936
6913
  var _targetElement$datase;
6937
-
6938
6914
  const targetElement = placeholder.nextElementSibling;
6939
-
6940
6915
  if (targetElement && ((_targetElement$datase = targetElement.dataset) == null ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
6941
6916
  targetElement.style.display = targetElement.dataset.originalDisplay;
6942
6917
  delete targetElement.dataset.originalDisplay;
6943
6918
  }
6944
-
6945
6919
  placeholder.remove();
6946
6920
  });
6947
6921
  };
6948
-
6949
6922
  const removeExcessMjxContainers = content => {
6950
6923
  const elements = content.querySelectorAll('[data-latex][data-math-handled="true"]');
6951
6924
  elements.forEach(element => {
6952
- const mjxContainers = element.querySelectorAll('mjx-container'); // Check if there are more than one mjx-container children.
6925
+ const mjxContainers = element.querySelectorAll('mjx-container');
6953
6926
 
6927
+ // Check if there are more than one mjx-container children.
6954
6928
  if (mjxContainers.length > 1) {
6955
6929
  for (let i = 1; i < mjxContainers.length; i++) {
6956
6930
  mjxContainers[i].parentNode.removeChild(mjxContainers[i]);
@@ -6958,7 +6932,6 @@ const removeExcessMjxContainers = content => {
6958
6932
  }
6959
6933
  });
6960
6934
  };
6961
-
6962
6935
  const renderContentsWithMathJax = el => {
6963
6936
  // el sometimes is an array
6964
6937
  // renderMath is used like that in pie-print-support and pie-element-extensions
@@ -6969,52 +6942,55 @@ const renderContentsWithMathJax = el => {
6969
6942
  renderContentWithMathJax(el);
6970
6943
  }
6971
6944
  };
6972
-
6973
6945
  const renderContentWithMathJax = executeOn => {
6974
- executeOn = executeOn || document.body; // this happens for charting - mark-label; we receive a ref which is not yet ready ( el = { current: null })
6975
- // we have to fix this in charting
6946
+ executeOn = executeOn || document.body;
6976
6947
 
6948
+ // this happens for charting - mark-label; we receive a ref which is not yet ready ( el = { current: null })
6949
+ // we have to fix this in charting
6977
6950
  if (!(executeOn instanceof HTMLElement)) return;
6978
6951
  fixMathElements(executeOn);
6979
6952
  adjustMathMLStyle(executeOn);
6980
6953
  const mathJaxInstance = getGlobal().instance;
6981
-
6982
6954
  if (mathJaxInstance) {
6983
6955
  // Reset and clear typesetting before processing the new content
6984
6956
  // Reset the tex labels (and automatic equation number).
6985
- mathJaxInstance.texReset(); // Reset the typesetting system (font caches, etc.)
6986
6957
 
6987
- mathJaxInstance.typesetClear(); // Use typesetPromise for asynchronous typesetting
6958
+ mathJaxInstance.texReset();
6959
+
6960
+ // Reset the typesetting system (font caches, etc.)
6961
+ mathJaxInstance.typesetClear();
6962
+
6963
+ // Use typesetPromise for asynchronous typesetting
6988
6964
  // Using MathJax.typesetPromise() for asynchronous typesetting to handle situations where additional code needs to be loaded (e.g., for certain TeX commands or characters).
6989
6965
  // This ensures typesetting waits for any needed resources to load and complete processing, unlike the synchronous MathJax.typeset() which can't handle such dynamic loading.
6990
-
6991
6966
  mathJaxInstance.typesetPromise([executeOn]).then(() => {
6992
6967
  try {
6993
6968
  removePlaceholdersAndRestoreDisplay();
6994
6969
  removeExcessMjxContainers(executeOn);
6995
6970
  const updatedDocument = mathJaxInstance.startup.document;
6996
6971
  const list = updatedDocument.math.list;
6997
-
6998
6972
  for (let item = list.next; typeof item.data !== 'symbol'; item = item.next) {
6999
6973
  const mathMl = toMMl(item.data.root);
7000
6974
  const parsedMathMl = mathMl.replaceAll('\n', '');
7001
6975
  item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
7002
6976
  item.data.typesetRoot.setAttribute('tabindex', '-1');
7003
- } // If the original input was a string, return the parsed MathML
6977
+ }
7004
6978
 
6979
+ // If the original input was a string, return the parsed MathML
7005
6980
  } catch (e) {
6981
+ // eslint-disable-next-line no-console
7006
6982
  console.error('Error post-processing MathJax typesetting:', e.toString());
7007
- } // Clearing the document if needed
7008
-
6983
+ }
7009
6984
 
6985
+ // Clearing the document if needed
7010
6986
  mathJaxInstance.startup.document.clear();
7011
6987
  }).catch(error => {
7012
6988
  // If there was an internal error, put the message into the output instead
6989
+ // eslint-disable-next-line no-console
7013
6990
  console.error('Error in typesetting with MathJax:', error);
7014
6991
  });
7015
6992
  }
7016
6993
  };
7017
-
7018
6994
  const convertMathJax2ToMathJax3 = () => {
7019
6995
  // Make MathJax v2 compatible with v3
7020
6996
  // https://docs.mathjax.org/en/v3.2-latest/upgrading/v2.html#version-2-compatibility-example
@@ -7026,24 +7002,22 @@ const convertMathJax2ToMathJax3 = () => {
7026
7002
  const RequireMethods = {
7027
7003
  Require: function (parser, name) {
7028
7004
  let required = parser.GetArgument(name);
7029
-
7030
7005
  if (required.match(/[^_a-zA-Z0-9]/) || required === '') {
7031
7006
  throw new TexError('BadPackageName', 'Argument for %1 is not a valid package name', name);
7032
7007
  }
7033
-
7034
- if (requireMap.hasOwnProperty(required)) {
7008
+ if (Object.prototype.hasOwnProperty.call(requireMap, required)) {
7035
7009
  required = requireMap[required];
7036
7010
  }
7037
-
7038
7011
  RequireLoad(parser, required);
7039
7012
  }
7040
7013
  };
7041
7014
  new CommandMap('require', {
7042
7015
  require: 'Require'
7043
- }, RequireMethods); //
7016
+ }, RequireMethods);
7017
+
7018
+ //
7044
7019
  // Add a replacement for MathJax.Callback command
7045
7020
  //
7046
-
7047
7021
  MathJax.Callback = function (args) {
7048
7022
  if (Array.isArray(args)) {
7049
7023
  if (args.length === 1 && typeof args[0] === 'function') {
@@ -7058,53 +7032,51 @@ const convertMathJax2ToMathJax3 = () => {
7058
7032
  } else if (typeof args === 'function') {
7059
7033
  return args;
7060
7034
  }
7035
+ throw Error('Can\'t make callback from given data');
7036
+ };
7061
7037
 
7062
- throw Error("Can't make callback from given data");
7063
- }; //
7038
+ //
7064
7039
  // Add a replacement for MathJax.Hub commands
7065
7040
  //
7066
-
7067
-
7068
7041
  MathJax.Hub = {
7069
7042
  Queue: function () {
7070
7043
  for (let i = 0, m = arguments.length; i < m; i++) {
7071
7044
  const fn = MathJax.Callback(arguments[i]);
7072
7045
  MathJax.startup.promise = MathJax.startup.promise.then(fn);
7073
7046
  }
7074
-
7075
7047
  return MathJax.startup.promise;
7076
7048
  },
7077
7049
  Typeset: function (elements, callback) {
7078
7050
  let promise = MathJax.typesetPromise(elements);
7079
-
7080
7051
  if (callback) {
7081
7052
  promise = promise.then(callback);
7082
7053
  }
7083
-
7084
7054
  return promise;
7085
7055
  },
7086
7056
  Register: {
7087
7057
  MessageHook: function () {
7058
+ // eslint-disable-next-line no-console
7088
7059
  console.log('MessageHooks are not supported in version 3');
7089
7060
  },
7090
7061
  StartupHook: function () {
7062
+ // eslint-disable-next-line no-console
7091
7063
  console.log('StartupHooks are not supported in version 3');
7092
7064
  },
7093
7065
  LoadHook: function () {
7066
+ // eslint-disable-next-line no-console
7094
7067
  console.log('LoadHooks are not supported in version 3');
7095
7068
  }
7096
7069
  },
7097
7070
  Config: function () {
7071
+ // eslint-disable-next-line no-console
7098
7072
  console.log('MathJax configurations should be converted for version 3');
7099
7073
  }
7100
7074
  };
7101
7075
  };
7102
-
7103
7076
  const initializeMathJax = callback => {
7104
7077
  if (window.mathjaxLoadedP) {
7105
7078
  return;
7106
7079
  }
7107
-
7108
7080
  const PreviousMathJaxIsUsed = window.MathJax && window.MathJax.version && window.MathJax.version !== MathJaxVersion && window.MathJax.version[0] === '2';
7109
7081
  const texConfig = {
7110
7082
  macros: {
@@ -7115,17 +7087,15 @@ const initializeMathJax = callback => {
7115
7087
  },
7116
7088
  displayMath: [['$$', '$$'], ['\\[', '\\]']]
7117
7089
  };
7118
-
7119
7090
  if (PreviousMathJaxIsUsed) {
7120
7091
  texConfig.autoload = {
7121
7092
  color: [],
7122
7093
  // don't autoload the color extension
7123
7094
  colorv2: ['color'] // do autoload the colorv2 extension
7124
-
7125
7095
  };
7126
- } // Create a new promise that resolves when MathJax is ready
7127
-
7096
+ }
7128
7097
 
7098
+ // Create a new promise that resolves when MathJax is ready
7129
7099
  window.mathjaxLoadedP = new Promise(resolve => {
7130
7100
  // Set up the MathJax configuration
7131
7101
  window.MathJax = {
@@ -7146,7 +7116,6 @@ const initializeMathJax = callback => {
7146
7116
  if (PreviousMathJaxIsUsed) {
7147
7117
  convertMathJax2ToMathJax3();
7148
7118
  }
7149
-
7150
7119
  const {
7151
7120
  mathjax
7152
7121
  } = MathJax._.mathjax;
@@ -7157,24 +7126,25 @@ const initializeMathJax = callback => {
7157
7126
  Menu
7158
7127
  } = MathJax._.ui.menu.Menu;
7159
7128
  const rerender = Menu.prototype.rerender;
7160
-
7161
7129
  Menu.prototype.rerender = function (start = STATE.TYPESET) {
7162
7130
  mathjax.handleRetriesFor(() => rerender.call(this, start));
7163
7131
  };
7164
-
7165
- MathJax.startup.defaultReady(); // Set the MathJax instance in the global object
7132
+ MathJax.startup.defaultReady();
7133
+ // Set the MathJax instance in the global object
7166
7134
 
7167
7135
  const globalObj = getGlobal();
7168
7136
  globalObj.instance = MathJax;
7169
7137
  window.mathjaxLoadedComplete = true;
7170
- console.log('MathJax has initialised!', new Date().toString()); // in this file, initializeMathJax is called with a callback that has to be executed when MathJax was loaded
7138
+ // eslint-disable-next-line no-console
7139
+ console.log('MathJax has initialised!', new Date().toString());
7171
7140
 
7141
+ // in this file, initializeMathJax is called with a callback that has to be executed when MathJax was loaded
7172
7142
  if (callback) {
7173
7143
  callback();
7174
- } // but previous versions of math-rendering-accessible they're expecting window.mathjaxLoadedP to be a Promise, so we also keep the
7175
- // resolve here;
7176
-
7144
+ }
7177
7145
 
7146
+ // but previous versions of math-rendering-accessible they're expecting window.mathjaxLoadedP to be a Promise, so we also keep the
7147
+ // resolve here;
7178
7148
  resolve();
7179
7149
  }
7180
7150
  },
@@ -7212,29 +7182,27 @@ const initializeMathJax = callback => {
7212
7182
  }
7213
7183
  }
7214
7184
  }
7215
- }; // Load the MathJax script
7216
-
7185
+ };
7186
+ // Load the MathJax script
7217
7187
  const script = document.createElement('script');
7218
7188
  script.type = 'text/javascript';
7219
7189
  script.src = `https://cdn.jsdelivr.net/npm/mathjax@${MathJaxVersion}/es5/tex-chtml-full.js`;
7220
7190
  script.async = true;
7221
- document.head.appendChild(script); // at this time of the execution, there's no document.body; setTimeout does the trick
7191
+ document.head.appendChild(script);
7222
7192
 
7193
+ // at this time of the execution, there's no document.body; setTimeout does the trick
7223
7194
  setTimeout(() => {
7224
7195
  if (!window.mathjaxLoadedComplete) {
7225
- var _document, _document$body;
7226
-
7227
- const mathElements = (_document = document) == null ? void 0 : (_document$body = _document.body) == null ? void 0 : _document$body.querySelectorAll('[data-latex]');
7196
+ var _document;
7197
+ const mathElements = (_document = document) == null || (_document = _document.body) == null ? void 0 : _document.querySelectorAll('[data-latex]');
7228
7198
  (mathElements || []).forEach(createPlaceholder);
7229
7199
  }
7230
7200
  });
7231
7201
  });
7232
7202
  };
7233
-
7234
- const renderMath = (el, renderOpts) => {
7203
+ const renderMath = el => {
7235
7204
  const usedForMmlOutput = typeof el === 'string';
7236
7205
  let executeOn = document.body;
7237
-
7238
7206
  if (!usedForMmlOutput) {
7239
7207
  // If math-rendering was not available, then:
7240
7208
  // If window.mathjaxLoadedComplete, it means that we initialised MathJax using the function from this file,
@@ -7249,7 +7217,10 @@ const renderMath = (el, renderOpts) => {
7249
7217
  window.mathjaxLoadedP.then(() => {
7250
7218
  window.mathjaxLoadedComplete = true;
7251
7219
  renderContentsWithMathJax(el);
7252
- }).catch(error => console.error('Error in initializing MathJax:', error));
7220
+ }).catch(error => {
7221
+ // eslint-disable-next-line no-console
7222
+ console.error('Error in initializing MathJax:', error);
7223
+ });
7253
7224
  }
7254
7225
  } else {
7255
7226
  // Here we're handling the case when renderMath is being called for mmlOutput
@@ -7257,7 +7228,6 @@ const renderMath = (el, renderOpts) => {
7257
7228
  const div = document.createElement('div');
7258
7229
  div.innerHTML = el;
7259
7230
  executeOn = div;
7260
-
7261
7231
  try {
7262
7232
  MathJax.texReset();
7263
7233
  MathJax.typesetClear();
@@ -7269,17 +7239,16 @@ const renderMath = (el, renderOpts) => {
7269
7239
  const parsedMathMl = mathMl.replaceAll('\n', '');
7270
7240
  return parsedMathMl;
7271
7241
  } catch (error) {
7242
+ // eslint-disable-next-line no-console
7272
7243
  console.error('Error rendering math:', error.message);
7273
7244
  }
7274
-
7275
7245
  return el;
7276
7246
  }
7277
-
7278
7247
  return el;
7279
7248
  }
7280
- }; // this function calls itself
7281
-
7249
+ };
7282
7250
 
7251
+ // this function calls itself
7283
7252
  (function () {
7284
7253
  initializeMathJax(renderContentWithMathJax);
7285
7254
  window[mathRenderingKEY] = {
@@ -7307,7 +7276,7 @@ function requireBundle_min () {
7307
7276
 
7308
7277
  var bundle_minExports = requireBundle_min();
7309
7278
 
7310
- var mmlToLatex = (mathml => bundle_minExports.MathMLToLaTeX.convert(mathml));
7279
+ var mmlToLatex = mathml => bundle_minExports.MathMLToLaTeX.convert(mathml);
7311
7280
 
7312
7281
  export { mmlToLatex, renderMath, unWrapMath, wrapMath };
7313
7282
  //# sourceMappingURL=index.js.map