Skip to content

Commit 640025b

Browse files
committed
build: use supported operators for GitHub rendering
1 parent 3d37c6a commit 640025b

File tree

21 files changed

+36
-21
lines changed

21 files changed

+36
-21
lines changed

lib/node_modules/@stdlib/_tools/remark/plugins/remark-img-equations/lib/insert_equations.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var logger = require( 'debug' );
2424
var createElement = require( '@stdlib/_tools/markdown/img-svg-equation' );
25+
var replace = require( '@stdlib/string/base/replace' );
2526
var format = require( '@stdlib/string/format' );
2627

2728

@@ -35,6 +36,20 @@ var ALT = /alt="([^"]*)"/;
3536
var RAW = /raw="([^"]*)"/;
3637

3738

39+
// FUNCTIONS //
40+
41+
/**
42+
* Substitutes LaTeX operators not supported by GitHub's MathJax configuration with supported operators.
43+
*
44+
* @private
45+
* @param {string} tex - LaTeX equation
46+
* @returns {string} substituted equation
47+
*/
48+
function substitute( tex ) {
49+
return replace( tex, /\\operatorname{([^}]*)}/g, '\\mathop{\\mathrm{$1}}' );
50+
}
51+
52+
3853
// MAIN //
3954

4055
/**
@@ -95,7 +110,7 @@ function insertEquations( node, index, parent ) {
95110

96111
mathNode = {
97112
'type': 'html',
98-
'value': '```math\n'+raw+'\n```'
113+
'value': '```math\n'+substitute(raw)+'\n```'
99114
};
100115
divNode = {
101116
'type': 'html',

lib/node_modules/@stdlib/simulate/iter/triangle-wave/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ A triangle waveform is represented by the following equation
3131
<!-- <equation class="equation" label="eq:triangle_waveform" align="center" raw="f(t; \tau, a, \varphi) = \frac{2a}{\pi} \operatorname{arcsin} \sin \frac{2\pi(t-\varphi)}{\tau}" alt="Equation for a triangle waveform."> -->
3232

3333
```math
34-
f(t; \tau, a, \varphi) = \frac{2a}{\pi} \operatorname{arcsin} \sin \frac{2\pi(t-\varphi)}{\tau}
34+
f(t; \tau, a, \varphi) = \frac{2a}{\pi} \mathop{\mathrm{arcsin}} \sin \frac{2\pi(t-\varphi)}{\tau}
3535
```
3636

3737
<!-- <div class="equation" align="center" data-raw-text="f(t; \tau, a, \varphi) = \frac{2a}{\pi} \operatorname{arcsin} \sin \frac{2\pi(t-\varphi)}{\tau}" data-equation="eq:triangle_waveform">

lib/node_modules/@stdlib/stats/base/dists/beta/entropy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The [differential entropy][entropy] for a [beta][beta-distribution] random varia
3131
<!-- <equation class="equation" label="eq:beta_entropy" align="center" raw="h\left( X \right) = \ln(\operatorname{Beta}(\alpha,\beta)) - (\alpha-1)\psi(\alpha) - (\beta-1)\psi(\beta) + (\alpha+\beta-2)\psi(\alpha+\beta)" alt="Differential entropy for a beta distribution."> -->
3232

3333
```math
34-
h\left( X \right) = \ln(\operatorname{Beta}(\alpha,\beta)) - (\alpha-1)\psi(\alpha) - (\beta-1)\psi(\beta) + (\alpha+\beta-2)\psi(\alpha+\beta)
34+
h\left( X \right) = \ln(\mathop{\mathrm{Beta}}(\alpha,\beta)) - (\alpha-1)\psi(\alpha) - (\beta-1)\psi(\beta) + (\alpha+\beta-2)\psi(\alpha+\beta)
3535
```
3636

3737
<!-- <div class="equation" align="center" data-raw-text="h\left( X \right) = \ln(\operatorname{Beta}(\alpha,\beta)) - (\alpha-1)\psi(\alpha) - (\beta-1)\psi(\beta) + (\alpha+\beta-2)\psi(\alpha+\beta)" data-equation="eq:beta_entropy">

lib/node_modules/@stdlib/stats/base/dists/beta/logcdf/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [cumulative distribution function][cdf] for a [beta][beta-distribution] rand
2929
<!-- <equation class="equation" label="eq:beta_cdf" align="center" raw="F(x;\alpha,\beta) = \frac{\operatorname{Beta}(x;\alpha,\beta)}{\operatorname{Beta}(\alpha,\beta)}" alt="Cumulative distribution function for a beta distribution."> -->
3030

3131
```math
32-
F(x;\alpha,\beta) = \frac{\operatorname{Beta}(x;\alpha,\beta)}{\operatorname{Beta}(\alpha,\beta)}
32+
F(x;\alpha,\beta) = \frac{\mathop{\mathrm{Beta}}(x;\alpha,\beta)}{\mathop{\mathrm{Beta}}(\alpha,\beta)}
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="F(x;\alpha,\beta) = \frac{\operatorname{Beta}(x;\alpha,\beta)}{\operatorname{Beta}(\alpha,\beta)}" data-equation="eq:beta_cdf">

lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [cumulative distribution function][cdf] for a [Cauchy][cauchy-distribution]
2929
<!-- <equation class="equation" label="eq:cauchy_cdf" align="center" raw="F(x; x_0,\gamma)=\frac{1}{\pi} \operatorname{arctan} \left(\frac{x-x_0}{\gamma}\right)+\frac{1}{2}" alt="Cumulative distribution function for a Cauchy distribution."> -->
3030

3131
```math
32-
F(x; x_0,\gamma)=\frac{1}{\pi} \operatorname{arctan} \left(\frac{x-x_0}{\gamma}\right)+\frac{1}{2}
32+
F(x; x_0,\gamma)=\frac{1}{\pi} \mathop{\mathrm{arctan}} \left(\frac{x-x_0}{\gamma}\right)+\frac{1}{2}
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="F(x; x_0,\gamma)=\frac{1}{\pi} \operatorname{arctan} \left(\frac{x-x_0}{\gamma}\right)+\frac{1}{2}" data-equation="eq:cauchy_cdf">

lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [cumulative distribution function][cdf] for a [Cauchy][cauchy-distribution]
2929
<!-- <equation class="equation" label="eq:cauchy_cdf" align="center" raw="F(x; x_0,\gamma)=\frac{1}{\pi} \operatorname{arctan} \left(\frac{x-x_0}{\gamma}\right)+\frac{1}{2}" alt="Cumulative distribution function for a Cauchy distribution."> -->
3030

3131
```math
32-
F(x; x_0,\gamma)=\frac{1}{\pi} \operatorname{arctan} \left(\frac{x-x_0}{\gamma}\right)+\frac{1}{2}
32+
F(x; x_0,\gamma)=\frac{1}{\pi} \mathop{\mathrm{arctan}} \left(\frac{x-x_0}{\gamma}\right)+\frac{1}{2}
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="F(x; x_0,\gamma)=\frac{1}{\pi} \operatorname{arctan} \left(\frac{x-x_0}{\gamma}\right)+\frac{1}{2}" data-equation="eq:cauchy_cdf">

lib/node_modules/@stdlib/stats/base/dists/laplace/cdf/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [cumulative distribution function][cdf] for a [Laplace][laplace-distribution
2929
<!-- <equation class="equation" label="eq:laplace_cdf" align="center" raw="F(x;\mu,b) =\tfrac{1}{2} + \tfrac{1}{2} \operatorname{sgn}(x-\mu) \left(1-\exp \left(-\frac{|x-\mu|}{b} \right ) \right )" alt="Cumulative distribution function for a Laplace distribution."> -->
3030

3131
```math
32-
F(x;\mu,b) =\tfrac{1}{2} + \tfrac{1}{2} \operatorname{sgn}(x-\mu) \left(1-\exp \left(-\frac{|x-\mu|}{b} \right ) \right )
32+
F(x;\mu,b) =\tfrac{1}{2} + \tfrac{1}{2} \mathop{\mathrm{sgn}}(x-\mu) \left(1-\exp \left(-\frac{|x-\mu|}{b} \right ) \right )
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="F(x;\mu,b) =\tfrac{1}{2} + \tfrac{1}{2} \operatorname{sgn}(x-\mu) \left(1-\exp \left(-\frac{|x-\mu|}{b} \right ) \right )" data-equation="eq:laplace_cdf">

lib/node_modules/@stdlib/stats/base/dists/laplace/logcdf/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [cumulative distribution function][cdf] for a [Laplace][laplace-distribution
2929
<!-- <equation class="equation" label="eq:laplace_cdf" align="center" raw="F(x;\mu,b) =\tfrac{1}{2} + \tfrac{1}{2} \operatorname{sgn}(x-\mu) \left(1-\exp \left(-\frac{|x-\mu|}{b} \right ) \right )" alt="Cumulative distribution function for a Laplace distribution."> -->
3030

3131
```math
32-
F(x;\mu,b) =\tfrac{1}{2} + \tfrac{1}{2} \operatorname{sgn}(x-\mu) \left(1-\exp \left(-\frac{|x-\mu|}{b} \right ) \right )
32+
F(x;\mu,b) =\tfrac{1}{2} + \tfrac{1}{2} \mathop{\mathrm{sgn}}(x-\mu) \left(1-\exp \left(-\frac{|x-\mu|}{b} \right ) \right )
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="F(x;\mu,b) =\tfrac{1}{2} + \tfrac{1}{2} \operatorname{sgn}(x-\mu) \left(1-\exp \left(-\frac{|x-\mu|}{b} \right ) \right )" data-equation="eq:laplace_cdf">

lib/node_modules/@stdlib/stats/base/dists/laplace/quantile/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [quantile function][quantile-function] for a [Laplace][laplace-distribution]
2929
<!-- <equation class="equation" label="eq:laplace_quantile_function" align="center" raw="Q(p) = \mu - b\,\operatorname{sgn}(p-0.5)\,\ln(1 - 2|p-0.5|)" alt="Quantile function for a Laplace distribution."> -->
3030

3131
```math
32-
Q(p) = \mu - b\,\operatorname{sgn}(p-0.5)\,\ln(1 - 2|p-0.5|)
32+
Q(p) = \mu - b\,\mathop{\mathrm{sgn}}(p-0.5)\,\ln(1 - 2|p-0.5|)
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="Q(p) = \mu - b\,\operatorname{sgn}(p-0.5)\,\ln(1 - 2|p-0.5|)" data-equation="eq:laplace_quantile_function">

lib/node_modules/@stdlib/stats/base/dists/levy/cdf/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [cumulative distribution function][cdf] for a [Lévy][levy-distribution] ran
2929
<!-- <equation class="equation" label="eq:levy_cdf" align="center" raw="F(x;\mu,b) = \begin{cases} \operatorname{erfc}\left(\sqrt{\frac{c}{2(x-\mu)}}\right) & \text{ for } x > \mu \\ 0 & \text{ otherwise } \end{cases}" alt="Cumulative distribution function for a Lévy distribution."> -->
3030

3131
```math
32-
F(x;\mu,b) = \begin{cases} \operatorname{erfc}\left(\sqrt{\frac{c}{2(x-\mu)}}\right) & \text{ for } x > \mu \\ 0 & \text{ otherwise } \end{cases}
32+
F(x;\mu,b) = \begin{cases} \mathop{\mathrm{erfc}}\left(\sqrt{\frac{c}{2(x-\mu)}}\right) & \text{ for } x > \mu \\ 0 & \text{ otherwise } \end{cases}
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="F(x;\mu,b) = \begin{cases} \operatorname{erfc}\left(\sqrt{\frac{c}{2(x-\mu)}}\right) &amp; \text{ for } x &gt; \mu \\ 0 &amp; \text{ otherwise } \end{cases}" data-equation="eq:levy_cdf">

0 commit comments

Comments
 (0)