@brightspace-ui/core 2.18.2 → 2.18.3

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.
@@ -383,6 +383,7 @@
383
383
  <mo>)</mo>
384
384
  </mrow>
385
385
  </math>
386
+ $$ {\color{red}x} + {\color{blue}y} = {\color{green}z} $$
386
387
  <p>The wizard (<span data-replace-me-id="0">Elmer Fudd</span>) quickly jinxed the gnomes before they vaporized.</p>
387
388
  </div>
388
389
  </d2l-html-block>
@@ -495,6 +496,7 @@
495
496
  <template>
496
497
  <d2l-html-block>
497
498
  <div>$$ f(x) = \int \mathrm{e}^{-x}\,\mathrm{d}x $$ $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$</div>
499
+ <div>$$ {\color{red}x} + {\color{blue}y} = {\color{green}z} $$</div>
498
500
  </d2l-html-block>
499
501
  </template>
500
502
  </d2l-demo-snippet>
@@ -507,7 +509,7 @@
507
509
  <div>
508
510
  An equation rendered using LaTeX...
509
511
  \( f(x) = \int \mathrm{e}^{-x}\,\mathrm{d}x \)
510
- ... and some text!
512
+ ... and some text ...
511
513
  </div>
512
514
  </d2l-html-block>
513
515
  </template>
@@ -68,8 +68,9 @@ export class HtmlBlockMathRenderer {
68
68
  elem.querySelectorAll('mspace[linebreak="newline"]').forEach(elm => {
69
69
  elm.setAttribute('style', lineBreakStyle);
70
70
  });
71
+
71
72
  await window.MathJax.startup.promise;
72
- window.MathJax.typeset([elem]);
73
+ window.MathJax.typesetShadow(elem.getRootNode(), elem);
73
74
  return elem;
74
75
  }
75
76
 
@@ -93,6 +94,11 @@ export function loadMathJax(mathJaxConfig) {
93
94
 
94
95
  if (mathJaxLoaded) return mathJaxLoaded;
95
96
 
97
+ const loadOptions = ['ui/menu'];
98
+ if (mathJaxConfig && mathJaxConfig.renderLatex) {
99
+ loadOptions.push('[tex]/all-packages');
100
+ }
101
+
96
102
  window.MathJax = {
97
103
  chtml: {
98
104
  scale: (mathJaxConfig && mathJaxConfig.outputScale) || 1
@@ -102,7 +108,7 @@ export function loadMathJax(mathJaxConfig) {
102
108
  settings: { zoom: 'None' }
103
109
  }
104
110
  },
105
- loader: { load: ['ui/menu'] },
111
+ loader: { load: loadOptions },
106
112
  startup: {
107
113
  ready: () => {
108
114
 
@@ -182,10 +188,13 @@ export function loadMathJax(mathJaxConfig) {
182
188
  // renders the document. The MathDocument is returned in case
183
189
  // you need to rerender the shadowRoot later.
184
190
  //
185
- window.MathJax.typesetShadow = function(root) {
191
+ window.MathJax.typesetShadow = function(root, elem) {
186
192
  const InputJax = startup.getInputJax();
187
193
  const OutputJax = startup.getOutputJax();
188
194
  const html = mathjax.document(root, { InputJax, OutputJax });
195
+
196
+ if (elem) html.options.elements = [elem];
197
+
189
198
  html.render().typeset();
190
199
  return html;
191
200
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.18.2",
3
+ "version": "2.18.3",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",