-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.d.ts
74 lines (74 loc) · 3.11 KB
/
app.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
export interface MathMLNowOptions {
/**
* The format of the math input
*/
formatName: "TeX" | "inline-TeX" | "AsciiMath" | "MathML";
/**
* Use to set the effective font-size (in pixels) of the maths expression (defaults to 18)
*/
fontSize?: number;
/**
* Use to set the color of the rendered equation (defaults to black). Accepts #rgb, #rrggbb or HTML color names
*/
fontColor?: string;
/**
* The amount of blank space that will be left at the top and bottom of the equation to account for
* differences between MathML and SVG - defaults to 0%
*/
verticalMarginPercent?: number;
/**
* The amount of blank space that will be left at the left and right of the equation to account for
* differences between MathML and SVG - defaults to 0%
*/
horizontalMarginPercent?: number;
}
import stream = require("stream");
import File = require("vinyl");
/**
* Generate a promise that resolves to a string of HTML that will display the inputted
* maths equation in a way understood by all browsers
* @param mathString The string representation of the maths equation you wish to display
* @param options The MathMLNowOptions object that will control the behaviour of the rendered equation
* @param id The ID number to use (should be incremented if called multiple times on the same page for unique ids)
*/
export function MathMLNow(mathString: string, options: MathMLNowOptions, id?: number) : Promise<string>;
/**
* A Gulp-style replacer function that will rewrite large chunks of text (like a HTML page),
* replacing instances of $$[Math string]$$ with the corresponding MathMLNow
*/
export declare class MathMlReplacer extends stream.Transform {
private options;
/**
* A Gulp-style replacer function that will rewrite large chunks of text (like a HTML page),
* replacing instances of $$[Math string]$$ with the corresponding MathML
* @param options The MathMLNowOptions object that will control the behaviour of the rendered equation
*/
constructor(options: MathMLNowOptions);
/**
* Like the normal JavaScript string replacer, but with an async callback function
* Solution taken from https://stackoverflow.com/a/33631886/7077589
* @param str The stream to replace
* @param re The regex to do matches with
* @param callback The async function to apply to the regex matches
*/
private replaceAsync;
/**
* Apply MathMLNow to a vinyl file
* @param file The file to assign our result to
* @param data The string data we read from the file
* @param enc The file encoding the file was initially in
* @param callback The function to call when we are done
*/
private rewriteFile;
/**
* Reads a stream into memory so that we can run Regex on it
* @param stream The stream to read from
* @param enc The encoding of the stream
* @param callback A callback function to run when we are done
*/
private streamToString;
/**
* @inheritdoc
*/
_transform(file: File, enc: BufferEncoding, callback: (err?: any, val?: File) => void): void;
}