@types/katex
Advanced tools
Comparing version 0.16.1 to 0.16.2
@@ -1,58 +0,60 @@ | ||
import { KatexOptions } from 'katex'; | ||
import { KatexOptions } from '../index.js'; | ||
export interface RenderMathInElementSpecificOptionsDelimiters { | ||
/** | ||
* A string which starts the math expression (i.e. the left delimiter) | ||
*/ | ||
left: string; | ||
/** | ||
* A string which ends the math expression (i.e. the right delimiter) | ||
*/ | ||
right: string; | ||
/** | ||
* A boolean of whether the math in the expression should be rendered in display mode or not | ||
*/ | ||
display: boolean | ||
} | ||
declare namespace renderMathInElement { | ||
interface RenderMathInElementSpecificOptionsDelimiters { | ||
/** | ||
* A string which starts the math expression (i.e. the left delimiter) | ||
*/ | ||
left: string; | ||
/** | ||
* A string which ends the math expression (i.e. the right delimiter) | ||
*/ | ||
right: string; | ||
/** | ||
* A boolean of whether the math in the expression should be rendered in display mode or not | ||
*/ | ||
display: boolean; | ||
} | ||
export interface RenderMathInElementSpecificOptions { | ||
/** | ||
* A list of delimiters to look for math | ||
* | ||
* @default [ | ||
* {left: "$$", right: "$$", display: true}, | ||
* {left: "\\(", right: "\\)", display: false}, | ||
* {left: "\\[", right: "\\]", display: true} | ||
* ] | ||
*/ | ||
delimiters?: ReadonlyArray<RenderMathInElementSpecificOptionsDelimiters> | undefined; | ||
/** | ||
* A list of DOM node types to ignore when recursing through | ||
* | ||
* @default ["script", "noscript", "style", "textarea", "pre", "code"] | ||
*/ | ||
ignoredTags?: ReadonlyArray<keyof HTMLElementTagNameMap> | undefined; | ||
/** | ||
* A list of DOM node class names to ignore when recursing through | ||
* | ||
* @default [] | ||
*/ | ||
ignoredClasses?: string[] | undefined; | ||
interface RenderMathInElementSpecificOptions { | ||
/** | ||
* A list of delimiters to look for math | ||
* | ||
* @default [ | ||
* {left: "$$", right: "$$", display: true}, | ||
* {left: "\\(", right: "\\)", display: false}, | ||
* {left: "\\[", right: "\\]", display: true} | ||
* ] | ||
*/ | ||
delimiters?: ReadonlyArray<RenderMathInElementSpecificOptionsDelimiters> | undefined; | ||
/** | ||
* A list of DOM node types to ignore when recursing through | ||
* | ||
* @default ["script", "noscript", "style", "textarea", "pre", "code"] | ||
*/ | ||
ignoredTags?: ReadonlyArray<keyof HTMLElementTagNameMap> | undefined; | ||
/** | ||
* A list of DOM node class names to ignore when recursing through | ||
* | ||
* @default [] | ||
*/ | ||
ignoredClasses?: string[] | undefined; | ||
/** | ||
* A callback method returning a message and an error stack in case of an critical error during rendering | ||
* @param msg Message generated by KaTeX | ||
* @param err Caught error | ||
* | ||
* @default console.error | ||
*/ | ||
errorCallback?(msg: string, err: Error): void; | ||
} | ||
/** | ||
* A callback method returning a message and an error stack in case of an critical error during rendering | ||
* @param msg Message generated by KaTeX | ||
* @param err Caught error | ||
* | ||
* @default console.error | ||
* renderMathInElement options contain KaTeX render options and renderMathInElement specific options | ||
*/ | ||
errorCallback?(msg: string, err: Error): void; | ||
type RenderMathInElementOptions = KatexOptions & RenderMathInElementSpecificOptions; | ||
} | ||
/** | ||
* renderMathInElement options contain KaTeX render options and renderMathInElement specific options | ||
*/ | ||
export type RenderMathInElementOptions = KatexOptions & RenderMathInElementSpecificOptions; | ||
/** | ||
* Auto-render TeX expressions in HTML element | ||
@@ -62,2 +64,5 @@ * @param elem HTML element to auto-render | ||
*/ | ||
export default function renderMathInElement(elem: HTMLElement, options?: RenderMathInElementOptions): void; | ||
declare function renderMathInElement(elem: HTMLElement, options?: renderMathInElement.RenderMathInElementOptions): void; | ||
export = renderMathInElement; | ||
export as namespace renderMathInElement; |
@@ -12,5 +12,5 @@ // Type definitions for KaTeX 0.16 | ||
export interface TrustContext { | ||
command: string | ||
url: string | ||
protocol: string | ||
command: string; | ||
url: string; | ||
protocol: string; | ||
} | ||
@@ -136,2 +136,5 @@ | ||
/** | ||
* KaTeX error, usually during parsing. | ||
*/ | ||
export class ParseError implements Error { | ||
@@ -145,24 +148,17 @@ constructor(message: string, lexer: any, position: number); | ||
declare const katex: { | ||
/** | ||
* Renders a TeX expression into the specified DOM element | ||
* @param tex A TeX expression | ||
* @param element The DOM element to render into | ||
* @param options KaTeX options | ||
*/ | ||
render: (tex: string, element: HTMLElement, options?: KatexOptions) => void, | ||
/** | ||
* Renders a TeX expression into the specified DOM element | ||
* @param tex A TeX expression | ||
* @param element The DOM element to render into | ||
* @param options KaTeX options | ||
*/ | ||
export function render(tex: string, element: HTMLElement, options?: KatexOptions): void; | ||
/** | ||
* Renders a TeX expression into an HTML string | ||
* @param tex A TeX expression | ||
* @param options KaTeX options | ||
*/ | ||
renderToString: (tex: string, options?: KatexOptions) => string, | ||
/** | ||
* Renders a TeX expression into an HTML string | ||
* @param tex A TeX expression | ||
* @param options KaTeX options | ||
*/ | ||
export function renderToString(tex: string, options?: KatexOptions): string; | ||
/** | ||
* KaTeX error, usually during parsing. | ||
*/ | ||
ParseError: typeof ParseError, | ||
} | ||
export default katex; | ||
export as namespace katex; |
{ | ||
"name": "@types/katex", | ||
"version": "0.16.1", | ||
"version": "0.16.2", | ||
"description": "TypeScript definitions for KaTeX", | ||
@@ -48,4 +48,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/katex", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "bc854e1fa6769ab535db715bce27480875f49100724c9a537abe2aa2d8f93801", | ||
"typesPublisherContentHash": "97e3026bd9920087b78bb6bcb68b773ba206b8401ecbbba8b4be79b16cf26da8", | ||
"typeScriptVersion": "4.3" | ||
} |
@@ -11,7 +11,7 @@ # Installation | ||
### Additional Details | ||
* Last updated: Wed, 12 Jul 2023 15:02:41 GMT | ||
* Last updated: Thu, 27 Jul 2023 09:02:51 GMT | ||
* Dependencies: none | ||
* Global values: none | ||
* Global values: `katex`, `renderMathInElement` | ||
# Credits | ||
These definitions were written by [Michael Randolph](https://github.com/mrand01), [Kevin Nguyen](https://github.com/knguyen0125), [bLue](https://github.com/dreamerblue), [Sebastian Weigand](https://github.com/s-weigand), [sapphi-red](https://github.com/sapphi-red), and [Stefaans](https://github.com/Stefaans). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10720
5
215