@supermanzm/streamdown-math 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +46 -0
- package/dist/index.js +1 -0
- package/package.json +45 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Pluggable } from 'unified';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin for math rendering (KaTeX)
|
|
5
|
+
*/
|
|
6
|
+
interface MathPlugin {
|
|
7
|
+
/**
|
|
8
|
+
* Get CSS styles path for math rendering
|
|
9
|
+
*/
|
|
10
|
+
getStyles?: () => string;
|
|
11
|
+
name: "katex";
|
|
12
|
+
/**
|
|
13
|
+
* Rehype plugin for rendering math
|
|
14
|
+
*/
|
|
15
|
+
rehypePlugin: Pluggable;
|
|
16
|
+
/**
|
|
17
|
+
* Remark plugin for parsing math syntax
|
|
18
|
+
*/
|
|
19
|
+
remarkPlugin: Pluggable;
|
|
20
|
+
type: "math";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Options for creating a math plugin
|
|
24
|
+
*/
|
|
25
|
+
interface MathPluginOptions {
|
|
26
|
+
/**
|
|
27
|
+
* KaTeX error color
|
|
28
|
+
* @default "var(--color-muted-foreground)"
|
|
29
|
+
*/
|
|
30
|
+
errorColor?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Enable single dollar sign for inline math ($...$)
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
singleDollarTextMath?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a math plugin with optional configuration
|
|
39
|
+
*/
|
|
40
|
+
declare function createMathPlugin(options?: MathPluginOptions): MathPlugin;
|
|
41
|
+
/**
|
|
42
|
+
* Pre-configured math plugin with default settings
|
|
43
|
+
*/
|
|
44
|
+
declare const math: MathPlugin;
|
|
45
|
+
|
|
46
|
+
export { type MathPlugin, type MathPluginOptions, createMathPlugin, math };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from'rehype-katex';import o from'remark-math';function g(e={}){var t,r;let a=[o,{singleDollarTextMath:(t=e.singleDollarTextMath)!=null?t:false}],l=[n,{errorColor:(r=e.errorColor)!=null?r:"var(--color-muted-foreground)"}];return {name:"katex",type:"math",remarkPlugin:a,rehypePlugin:l,getStyles(){return "katex/dist/katex.min.css"}}}var h=g();export{g as createMathPlugin,h as math};
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@supermanzm/streamdown-math",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"test:coverage": "vitest --coverage run"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"katex": "^0.16.27",
|
|
27
|
+
"rehype-katex": "^7.0.1",
|
|
28
|
+
"remark-math": "^6.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
32
|
+
"tsup": "^8.5.1",
|
|
33
|
+
"typescript": "^5.9.3",
|
|
34
|
+
"unified": "^11.0.5",
|
|
35
|
+
"vitest": "^4.0.15"
|
|
36
|
+
},
|
|
37
|
+
"author": "Hayden Bleasel <hayden.bleasel@vercel.com>",
|
|
38
|
+
"license": "Apache-2.0",
|
|
39
|
+
"description": "KaTeX math rendering plugin for Streamdown",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/vercel/streamdown.git",
|
|
43
|
+
"directory": "packages/streamdown-math"
|
|
44
|
+
}
|
|
45
|
+
}
|