Update katex to v0.16.21
parent
d663b8aa90
commit
3ac8d7b9b8
@ -1 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};return function(){r.d(o,{default:function(){return d}});var e=r(771),t=r.n(e);const n=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},i=/^\\begin{/;var a=function(e,t){let r;const o=[],a=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;r=e.search(a),-1!==r;){r>0&&(o.push({type:"text",data:e.slice(0,r)}),e=e.slice(r));const a=t.findIndex((t=>e.startsWith(t.left)));if(r=n(t[a].right,e,t[a].left.length),-1===r)break;const l=e.slice(0,r+t[a].right.length),s=i.test(l)?l:e.slice(t[a].left.length,r);o.push({type:"math",data:s,rawData:l,display:t[a].display}),e=e.slice(r+t[a].right.length)}return""!==e&&o.push({type:"text",data:e}),o};const l=function(e,n){const r=a(e,n.delimiters);if(1===r.length&&"text"===r[0].type)return null;const o=document.createDocumentFragment();for(let e=0;e<r.length;e++)if("text"===r[e].type)o.appendChild(document.createTextNode(r[e].data));else{const i=document.createElement("span");let a=r[e].data;n.displayMode=r[e].display;try{n.preProcess&&(a=n.preProcess(a)),t().render(a,i,n)}catch(i){if(!(i instanceof t().ParseError))throw i;n.errorCallback("KaTeX auto-render: Failed to parse `"+r[e].data+"` with ",i),o.appendChild(document.createTextNode(r[e].rawData));continue}o.appendChild(i)}return o},s=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const s=l(o,t);if(s){for(let e=0;e<a;e++)r.nextSibling.remove();n+=s.childNodes.length-1,e.replaceChild(s,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";-1===t.ignoredTags.indexOf(r.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&s(r,t)}}};var d=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},s(e,n)}}(),o=o.default}()}));
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={757:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};r.d(o,{default:function(){return p}});var i=r(757),a=r.n(i);const l=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},s=/^\\begin{/;var d=function(e,t){let n;const r=[],o=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;n=e.search(o),-1!==n;){n>0&&(r.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));const o=t.findIndex((t=>e.startsWith(t.left)));if(n=l(t[o].right,e,t[o].left.length),-1===n)break;const i=e.slice(0,n+t[o].right.length),a=s.test(i)?i:e.slice(t[o].left.length,n);r.push({type:"math",data:a,rawData:i,display:t[o].display}),e=e.slice(n+t[o].right.length)}return""!==e&&r.push({type:"text",data:e}),r};const c=function(e,t){const n=d(e,t.delimiters);if(1===n.length&&"text"===n[0].type)return null;const r=document.createDocumentFragment();for(let e=0;e<n.length;e++)if("text"===n[e].type)r.appendChild(document.createTextNode(n[e].data));else{const o=document.createElement("span");let i=n[e].data;t.displayMode=n[e].display;try{t.preProcess&&(i=t.preProcess(i)),a().render(i,o,t)}catch(o){if(!(o instanceof a().ParseError))throw o;t.errorCallback("KaTeX auto-render: Failed to parse `"+n[e].data+"` with ",o),r.appendChild(document.createTextNode(n[e].rawData));continue}r.appendChild(o)}return r},f=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const l=c(o,t);if(l){for(let e=0;e<a;e++)r.nextSibling.remove();n+=l.childNodes.length-1,e.replaceChild(l,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";-1===t.ignoredTags.indexOf(r.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&f(r,t)}}};var p=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},f(e,n)};return o=o.default}()}));
|
@ -1 +1 @@
|
||||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var n="object"==typeof exports?t(require("katex")):t(e.katex);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};return function(){var e=r(771),t=r.n(e);let n=document.body.getElementsByTagName("script");n=Array.prototype.slice.call(n),n.forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;const n=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(n?"div":"span");r.setAttribute("class",n?"equation":"inline-equation");try{t().render(e.text,r,{displayMode:n})}catch(t){r.textContent=e.text}e.parentNode.replaceChild(r,e)}))}(),o=o.default}()}));
|
||||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var n="object"==typeof exports?t(require("katex")):t(e.katex);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={757:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={},i=r(757),a=r.n(i);let u=document.body.getElementsByTagName("script");return u=Array.prototype.slice.call(u),u.forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;const t=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),n=document.createElement(t?"div":"span");n.setAttribute("class",t?"equation":"inline-equation");try{a().render(e.text,n,{displayMode:t})}catch(t){n.textContent=e.text}e.parentNode.replaceChild(n,e)})),o=o.default}()}));
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,64 +0,0 @@
|
||||
@font-folder: "../fonts";
|
||||
@use-ttf: true;
|
||||
@use-woff: true;
|
||||
@use-woff2: true;
|
||||
|
||||
.use-woff2(@family, @family-suffix) when (@use-woff2 = true) {
|
||||
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff2') format('woff2')
|
||||
}
|
||||
|
||||
.use-woff(@family, @family-suffix) when (@use-woff = true) {
|
||||
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff') format('woff')
|
||||
}
|
||||
|
||||
.use-ttf(@family, @family-suffix) when (@use-ttf = true) {
|
||||
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.ttf') format('truetype')
|
||||
}
|
||||
|
||||
.generate-suffix(@weight, @style) when (@weight = normal) and (@style = normal) {
|
||||
@suffix: 'Regular';
|
||||
}
|
||||
.generate-suffix(@weight, @style) when (@weight = normal) and (@style = italic) {
|
||||
@suffix: 'Italic';
|
||||
}
|
||||
.generate-suffix(@weight, @style) when (@weight = bold) and (@style = normal) {
|
||||
@suffix: 'Bold';
|
||||
}
|
||||
.generate-suffix(@weight, @style) when (@weight = bold) and (@style = italic) {
|
||||
@suffix: 'BoldItalic';
|
||||
}
|
||||
|
||||
.font-face(@family, @weight, @style) {
|
||||
.generate-suffix(@weight, @style);
|
||||
@font-face {
|
||||
font-family: 'KaTeX_@{family}';
|
||||
.use-woff2(@family, @suffix);
|
||||
.use-woff(@family, @suffix);
|
||||
.use-ttf(@family, @suffix);
|
||||
font-weight: @weight;
|
||||
font-style: @style;
|
||||
}
|
||||
}
|
||||
|
||||
.font-face('AMS', normal, normal);
|
||||
.font-face('Caligraphic', bold, normal);
|
||||
.font-face('Caligraphic', normal, normal);
|
||||
.font-face('Fraktur', bold, normal);
|
||||
.font-face('Fraktur', normal, normal);
|
||||
.font-face('Main', bold, normal);
|
||||
.font-face('Main', bold, italic);
|
||||
.font-face('Main', normal, italic);
|
||||
.font-face('Main', normal, normal);
|
||||
//.font-face('Math', bold, normal);
|
||||
.font-face('Math', bold, italic);
|
||||
.font-face('Math', normal, italic);
|
||||
//.font-face('Math', normal, normal);
|
||||
.font-face('SansSerif', bold, normal);
|
||||
.font-face('SansSerif', normal, italic);
|
||||
.font-face('SansSerif', normal, normal);
|
||||
.font-face('Script', normal, normal);
|
||||
.font-face('Size1', normal, normal);
|
||||
.font-face('Size2', normal, normal);
|
||||
.font-face('Size3', normal, normal);
|
||||
.font-face('Size4', normal, normal);
|
||||
.font-face('Typewriter', normal, normal);
|
@ -0,0 +1,71 @@
|
||||
$font-folder: "../../fonts" !default;
|
||||
$use-woff2: true !default;
|
||||
$use-woff: true !default;
|
||||
$use-ttf: true !default;
|
||||
|
||||
@function generate-src($family, $family-suffix) {
|
||||
$src: null;
|
||||
@if $use-woff2 {
|
||||
$src: append($src, url('#{$font-folder}/KaTeX_#{$family}-#{$family-suffix}.woff2') format('woff2'), comma);
|
||||
}
|
||||
@if $use-woff {
|
||||
$src: append($src, url('#{$font-folder}/KaTeX_#{$family}-#{$family-suffix}.woff') format('woff'), comma);
|
||||
}
|
||||
@if $use-ttf {
|
||||
$src: append($src, url('#{$font-folder}/KaTeX_#{$family}-#{$family-suffix}.ttf') format('truetype'), comma);
|
||||
}
|
||||
|
||||
@return $src;
|
||||
}
|
||||
|
||||
@function generate-suffix($weight, $style) {
|
||||
$suffix: null;
|
||||
|
||||
@if $weight == normal and $style == normal {
|
||||
$suffix: 'Regular';
|
||||
}
|
||||
@if $weight == normal and $style == italic {
|
||||
$suffix: 'Italic';
|
||||
}
|
||||
@if $weight == bold and $style == normal {
|
||||
$suffix: 'Bold';
|
||||
}
|
||||
@if $weight == bold and $style == italic {
|
||||
$suffix: 'BoldItalic';
|
||||
}
|
||||
|
||||
@return $suffix;
|
||||
}
|
||||
|
||||
@mixin font-face($family, $weight, $style) {
|
||||
$suffix: generate-suffix($weight, $style);
|
||||
$src: generate-src($family, $suffix);
|
||||
|
||||
@font-face {
|
||||
font-family: 'KaTeX_#{$family}';
|
||||
src: $src;
|
||||
font-weight: $weight;
|
||||
font-style: $style;
|
||||
}
|
||||
}
|
||||
|
||||
@include font-face('AMS', normal, normal);
|
||||
@include font-face('Caligraphic', bold, normal);
|
||||
@include font-face('Caligraphic', normal, normal);
|
||||
@include font-face('Fraktur', bold, normal);
|
||||
@include font-face('Fraktur', normal, normal);
|
||||
@include font-face('Main', bold, normal);
|
||||
@include font-face('Main', bold, italic);
|
||||
@include font-face('Main', normal, italic);
|
||||
@include font-face('Main', normal, normal);
|
||||
@include font-face('Math', bold, italic);
|
||||
@include font-face('Math', normal, italic);
|
||||
@include font-face('SansSerif', bold, normal);
|
||||
@include font-face('SansSerif', normal, italic);
|
||||
@include font-face('SansSerif', normal, normal);
|
||||
@include font-face('Script', normal, normal);
|
||||
@include font-face('Size1', normal, normal);
|
||||
@include font-face('Size2', normal, normal);
|
||||
@include font-face('Size3', normal, normal);
|
||||
@include font-face('Size4', normal, normal);
|
||||
@include font-face('Typewriter', normal, normal);
|
72
paige/node_modules/katex/src/katex.less → paige/node_modules/katex/src/styles/katex.scss
generated
vendored
72
paige/node_modules/katex/src/katex.less → paige/node_modules/katex/src/styles/katex.scss
generated
vendored
@ -0,0 +1,258 @@
|
||||
// Adapted from
|
||||
// - https://katex.org/docs/options
|
||||
// - https://katex.org/docs/api
|
||||
// - https://katex.org/docs/error
|
||||
// for v0.16.11 on 2024/12/01
|
||||
// with some references from https://www.npmjs.com/package/@types/katex
|
||||
|
||||
/**
|
||||
* For the `trust` option in `KatexOptions`, a custom function
|
||||
* `handler(context)` can be provided to customize behavior depending on the
|
||||
* context (command, arguments e.g. a URL, etc.)
|
||||
* @see https://katex.org/docs/options
|
||||
*/
|
||||
export type TrustContext =
|
||||
| { command: "\\url", url: string, protocol?: string }
|
||||
| { command: "\\href", url: string, protocol?: string }
|
||||
| { command: "\\includegraphics", url: string, protocol?: string }
|
||||
| { command: "\\htmlClass", class: string }
|
||||
| { command: "\\htmlId", id: string }
|
||||
| { command: "\\htmlStyle", style: string }
|
||||
| { command: "\\htmlData", attributes: Record<string, string> }
|
||||
|
||||
|
||||
export type Catcodes = Record<string, number>;
|
||||
|
||||
export interface Lexer {
|
||||
input: string;
|
||||
tokenRegex: RegExp;
|
||||
settings: Required<KatexOptions>;
|
||||
catcodes: Catcodes;
|
||||
}
|
||||
|
||||
export interface SourceLocation {
|
||||
start: number;
|
||||
end: number;
|
||||
lexer: Lexer;
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
text: string;
|
||||
loc: SourceLocation | undefined;
|
||||
noexpand?: boolean;
|
||||
treatAsRelax?: boolean;
|
||||
}
|
||||
|
||||
|
||||
export type StrictFunction = (
|
||||
errorCode:
|
||||
| "unknownSymbol"
|
||||
| "unicodeTextInMathMode"
|
||||
| "mathVsTextUnits"
|
||||
| "commentAtEnd"
|
||||
| "htmlExtension"
|
||||
| "newLineInDisplayMode",
|
||||
errorMsg: string,
|
||||
token: Token,
|
||||
) => boolean | "error" | "warn" | "ignore" | undefined;
|
||||
|
||||
|
||||
/**
|
||||
* Options for `katex.render` and `katex.renderToString`.
|
||||
* @see https://katex.org/docs/options
|
||||
*/
|
||||
export interface KatexOptions {
|
||||
/**
|
||||
* If `true` the math will be rendered in display mode.
|
||||
* If `false` the math will be rendered in inline mode.
|
||||
* @see https://katex.org/docs/options
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
displayMode?: boolean;
|
||||
/**
|
||||
* Determines the markup language of the output. The valid choices are:
|
||||
* - `html`: Outputs KaTeX in HTML only.
|
||||
* - `mathml`: Outputs KaTeX in MathML only.
|
||||
* - `htmlAndMathml`: Outputs HTML for visual rendering and includes MathML
|
||||
* for accessibility.
|
||||
*
|
||||
* @default "htmlAndMathml"
|
||||
*/
|
||||
output?: "html" | "mathml" | "htmlAndMathml";
|
||||
/**
|
||||
* If `true`, display math has `\tag`s rendered on the left instead of the
|
||||
* right, like `\usepackage[leqno]{amsmath}` in LaTeX.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
leqno?: boolean;
|
||||
/**
|
||||
* If `true`, display math renders flush left with a `2em` left margin,
|
||||
* like `\documentclass[fleqn]` in LaTeX with the `amsmath` package.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
fleqn?: boolean;
|
||||
/**
|
||||
* If `true`, KaTeX will throw a `ParseError` when it encounters an
|
||||
* unsupported command or invalid LaTeX.
|
||||
* If `false`, KaTeX will render unsupported commands as text, and render
|
||||
* invalid LaTeX as its source code with hover text giving the error, in
|
||||
* the color given by `errorColor`.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
throwOnError?: boolean;
|
||||
/**
|
||||
* A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option
|
||||
* determines the color that unsupported commands and invalid LaTeX are
|
||||
* rendered in when `throwOnError` is set to `false`.
|
||||
*
|
||||
* @default "#cc0000"
|
||||
*/
|
||||
errorColor?: string;
|
||||
/**
|
||||
* A collection of custom macros.
|
||||
* @see https://katex.org/docs/options
|
||||
*/
|
||||
macros?: Record<string, string | object | ((macroExpander:object) => string | object)>;
|
||||
/**
|
||||
* Specifies a minimum thickness, in ems, for fraction lines, `\sqrt` top
|
||||
* lines, `{array}` vertical lines, `\hline`, `\hdashline`, `\underline`,
|
||||
* `\overline`, and the borders of `\fbox`, `\boxed`, and `\fcolorbox`.
|
||||
* The usual value for these items is `0.04`, so for `minRuleThickness`
|
||||
* to be effective it should probably take a value slightly above `0.04`,
|
||||
* say `0.05` or `0.06`. Negative values will be ignored.
|
||||
*/
|
||||
minRuleThickness?: number;
|
||||
/**
|
||||
* In early versions of both KaTeX (<0.8.0) and MathJax, the `\color`
|
||||
* function expected the content to be a function argument, as in
|
||||
* `\color{blue}{hello}`. In current KaTeX, `\color` is a switch, as in
|
||||
* `\color{blue}` hello. This matches LaTeX behavior. If you want the old
|
||||
* `\color` behavior, set option colorIsTextColor to true.
|
||||
*/
|
||||
colorIsTextColor?: boolean;
|
||||
/**
|
||||
* All user-specified sizes, e.g. in `\rule{500em}{500em}`, will be capped
|
||||
* to `maxSize` ems. If set to `Infinity` (the default), users can make
|
||||
* elements and spaces arbitrarily large.
|
||||
*
|
||||
* @default Infinity
|
||||
*/
|
||||
maxSize?: number;
|
||||
/**
|
||||
* Limit the number of macro expansions to the specified number, to prevent
|
||||
* e.g. infinite macro loops. `\edef` expansion counts all expanded tokens.
|
||||
* If set to `Infinity`, the macro expander will try to fully expand as in
|
||||
* LaTeX.
|
||||
*
|
||||
* @default 1000
|
||||
*/
|
||||
maxExpand?: number;
|
||||
/**
|
||||
* If `false` or `"ignore"`, allow features that make writing LaTeX
|
||||
* convenient but are not actually supported by (Xe)LaTeX
|
||||
* (similar to MathJax).
|
||||
* If `true` or `"error"` (LaTeX faithfulness mode), throw an error for any
|
||||
* such transgressions.
|
||||
* If `"warn"` (the default), warn about such behavior via `console.warn`.
|
||||
* Provide a custom function `handler(errorCode, errorMsg, token)` to
|
||||
* customize behavior depending on the type of transgression (summarized by
|
||||
* the string code `errorCode` and detailed in `errorMsg`); this function
|
||||
* can also return `"ignore"`, `"error"`, or `"warn"` to use a built-in
|
||||
* behavior.
|
||||
* @see https://katex.org/docs/options
|
||||
*
|
||||
* @default "warn"
|
||||
*/
|
||||
strict?:
|
||||
| boolean
|
||||
| "ignore" | "warn" | "error"
|
||||
| StrictFunction;
|
||||
/**
|
||||
* If `false` (do not trust input), prevent any commands like
|
||||
* `\includegraphics` that could enable adverse behavior, rendering them
|
||||
* instead in `errorColor`.
|
||||
* If `true` (trust input), allow all such commands.
|
||||
* Provide a custom function `handler(context)` to customize behavior
|
||||
* depending on the context (command, arguments e.g. a URL, etc.).
|
||||
* @see https://katex.org/docs/options
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
trust?: boolean | ((context: TrustContext) => boolean);
|
||||
/**
|
||||
* Run KaTeX code in the global group. As a consequence, macros defined at
|
||||
* the top level by `\def` and `\newcommand` are added to the macros
|
||||
* argument and can be used in subsequent render calls. In LaTeX,
|
||||
* constructs such as `\begin{equation}` and `$$` create a local group and
|
||||
* prevent definitions other than `\gdef` from becoming visible outside of
|
||||
* those blocks, so this is KaTeX's default behavior.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
globalGroup?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* In-browser rendering
|
||||
*
|
||||
* Call the `render` function with a TeX expression and a DOM element to
|
||||
* render into.
|
||||
*
|
||||
* @param {string} tex A TeX expression.
|
||||
* @param {HTMLElement} element A HTML DOM element.
|
||||
* @param {KatexOptions} options An options object.
|
||||
* @returns {void}
|
||||
* @see https://katex.org/docs/api
|
||||
*/
|
||||
export function render(
|
||||
tex: string,
|
||||
element: HTMLElement,
|
||||
options?: KatexOptions,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Server-side rendering or rendering to a string
|
||||
*
|
||||
* Use the `renderToString` function to generate HTML on the server or to
|
||||
* generate an HTML string of the rendered math.
|
||||
*
|
||||
* @param {string} tex A TeX expression.
|
||||
* @param {KatexOptions} options An options object.
|
||||
* @returns {string} The HTML string of the rendered math.
|
||||
* @see https://katex.org/docs/api
|
||||
*/
|
||||
export function renderToString(tex: string, options?: KatexOptions): string;
|
||||
|
||||
/**
|
||||
* If KaTeX encounters an error (invalid or unsupported LaTeX) and
|
||||
* `throwOnError` hasn't been set to `false`, then `katex.render` and
|
||||
* `katex.renderToString` will throw an exception of type
|
||||
* `ParseError`. The message in this error includes some of the LaTeX source
|
||||
* code, so needs to be escaped if you want to render it to HTML.
|
||||
* @see https://katex.org/docs/error
|
||||
*/
|
||||
export class ParseError implements Error {
|
||||
constructor(message: string, token?: object);
|
||||
name: "ParseError";
|
||||
position: number;
|
||||
length: number;
|
||||
rawMessage: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export const version: string;
|
||||
|
||||
export as namespace katex;
|
||||
|
||||
declare const katex: {
|
||||
version: string;
|
||||
render: typeof render;
|
||||
renderToString: typeof renderToString;
|
||||
ParseError: typeof ParseError;
|
||||
};
|
||||
|
||||
export default katex;
|
Loading…
Reference in New Issue