@types/katex
Advanced tools
Comparing version 0.11.1 to 0.16.0
@@ -1,64 +0,62 @@ | ||
declare module 'katex/dist/contrib/auto-render' { | ||
import { KatexOptions } from 'katex'; | ||
import { KatexOptions } from 'katex'; | ||
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 | ||
} | ||
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 | ||
} | ||
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; | ||
/** | ||
* 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; | ||
} | ||
export interface RenderMathInElementSpecificOptions { | ||
/** | ||
* renderMathInElement options contain KaTeX render options and renderMathInElement specific options | ||
* A list of delimiters to look for math | ||
* | ||
* @default [ | ||
* {left: "$$", right: "$$", display: true}, | ||
* {left: "\\(", right: "\\)", display: false}, | ||
* {left: "\\[", right: "\\]", display: true} | ||
* ] | ||
*/ | ||
export type RenderMathInElementOptions = KatexOptions & RenderMathInElementSpecificOptions; | ||
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; | ||
/** | ||
* Auto-render TeX expressions in HTML element | ||
* @param elem HTML element to auto-render | ||
* @param options Render options | ||
* 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 | ||
*/ | ||
function renderMathInElement(elem: HTMLElement, options?: RenderMathInElementOptions): void; | ||
export default renderMathInElement; | ||
errorCallback?(msg: string, err: Error): void; | ||
} | ||
/** | ||
* renderMathInElement options contain KaTeX render options and renderMathInElement specific options | ||
*/ | ||
export type RenderMathInElementOptions = KatexOptions & RenderMathInElementSpecificOptions; | ||
/** | ||
* Auto-render TeX expressions in HTML element | ||
* @param elem HTML element to auto-render | ||
* @param options Render options | ||
*/ | ||
export default function renderMathInElement(elem: HTMLElement, options?: RenderMathInElementOptions): void; |
@@ -1,20 +0,19 @@ | ||
declare module 'katex/contrib/copy-tex/katex2tex' { | ||
/** | ||
* Set these to how you want inline and display math to be delimited. | ||
*/ | ||
export interface CopyDelimiters { | ||
inline: ['$', '$'] | ['(', ')']; | ||
display: ['$$', '$$'] | ['[', ']']; | ||
} | ||
/** | ||
* Replace .katex elements with their TeX source (<annotation> element). | ||
* Modifies fragment in-place. Useful for writing your own 'copy' handler, | ||
* as in https://github.com/KaTeX/KaTeX/blob/master/contrib/copy-tex/copy-tex.js. | ||
* @param fragment Selected fragment of the DOM. | ||
* @param copyDelimiters Delimiters for inline and display math. | ||
*/ | ||
export default function katexReplaceWithTex( | ||
fragment: DocumentFragment, | ||
copyDelimiters?: CopyDelimiters, | ||
): DocumentFragment; | ||
/** | ||
* Set these to how you want inline and display math to be delimited. | ||
*/ | ||
export interface CopyDelimiters { | ||
inline: ['$', '$'] | ['(', ')']; | ||
display: ['$$', '$$'] | ['[', ']']; | ||
} | ||
/** | ||
* Replace .katex elements with their TeX source (<annotation> element). | ||
* Modifies fragment in-place. Useful for writing your own 'copy' handler, | ||
* as in https://github.com/KaTeX/KaTeX/blob/master/contrib/copy-tex/copy-tex.js. | ||
* @param fragment Selected fragment of the DOM. | ||
* @param copyDelimiters Delimiters for inline and display math. | ||
*/ | ||
export default function katexReplaceWithTex( | ||
fragment: DocumentFragment, | ||
copyDelimiters?: CopyDelimiters, | ||
): DocumentFragment; |
@@ -1,2 +0,2 @@ | ||
// Type definitions for KaTeX 0.11 | ||
// Type definitions for KaTeX 0.16 | ||
// Project: http://khan.github.io/KaTeX/ | ||
@@ -8,9 +8,5 @@ // Definitions by: Michael Randolph <https://github.com/mrand01> | ||
// sapphi-red <https://github.com/sapphi-red> | ||
// Stefaans <https://github.com/Stefaans> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.1 | ||
/// <reference path="contrib/index.d.ts" /> | ||
export as namespace katex; | ||
export interface TrustContext { | ||
@@ -142,2 +138,3 @@ command: string | ||
constructor(message: string, lexer: any, position: number); | ||
name: string; | ||
@@ -148,14 +145,22 @@ message: string; | ||
/** | ||
* 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 | ||
*/ | ||
export function renderToString(tex: string, options?: KatexOptions): string; | ||
export default class 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 | ||
*/ | ||
static 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 | ||
*/ | ||
static renderToString(tex: string, options?: KatexOptions): string; | ||
/** | ||
* KaTeX error, usually during parsing. | ||
*/ | ||
static ParseError: typeof ParseError; | ||
} |
{ | ||
"name": "@types/katex", | ||
"version": "0.11.1", | ||
"version": "0.16.0", | ||
"description": "TypeScript definitions for KaTeX", | ||
@@ -32,2 +32,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/katex", | ||
"githubUsername": "sapphi-red" | ||
}, | ||
{ | ||
"name": "Stefaans", | ||
"url": "https://github.com/Stefaans", | ||
"githubUsername": "Stefaans" | ||
} | ||
@@ -44,4 +49,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "e33977d7848121fc37a4552e4b849fb9d4ce0641e42edf118f01baefaea67fc3", | ||
"typeScriptVersion": "3.6" | ||
"typesPublisherContentHash": "761ad95697089a787d7b10366e497a9466fbf0106652f407007e47f96cd317c4", | ||
"typeScriptVersion": "4.2" | ||
} |
@@ -11,7 +11,7 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 06 Jul 2021 22:02:36 GMT | ||
* Last updated: Sat, 24 Dec 2022 11:32:36 GMT | ||
* Dependencies: none | ||
* Global values: `katex` | ||
* Global values: none | ||
# 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), and [sapphi-red](https://github.com/sapphi-red). | ||
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
11150
6
231