@assistant-ui/react-syntax-highlighter 0.10.0 → 0.10.1
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
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { makeSyntaxHighlighter, makeLightSyntaxHighlighter, makeLightAsyncSyntaxHighlighter, makePrismSyntaxHighlighter, makePrismLightSyntaxHighlighter, makePrismAsyncSyntaxHighlighter, makePrismAsyncLightSyntaxHighlighter, } from "./react-syntax-highlighter";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,+BAA+B,EAC/B,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,GACrC,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
import { SyntaxHighlighterProps as SHP } from "react-syntax-highlighter";
|
|
3
|
+
import type { SyntaxHighlighterProps } from "@assistant-ui/react-markdown";
|
|
4
|
+
export declare const makeSyntaxHighlighter: (config: Omit<SHP, "language" | "children">) => FC<SyntaxHighlighterProps>;
|
|
5
|
+
export declare const makePrismSyntaxHighlighter: (config: Omit<SHP, "language" | "children">) => FC<SyntaxHighlighterProps>;
|
|
6
|
+
export declare const makePrismAsyncSyntaxHighlighter: (config: Omit<SHP, "language" | "children">) => FC<SyntaxHighlighterProps>;
|
|
7
|
+
export declare const makePrismAsyncLightSyntaxHighlighter: (config: Omit<SHP, "language" | "children">) => FC<SyntaxHighlighterProps>;
|
|
8
|
+
export declare const makePrismLightSyntaxHighlighter: (config: Omit<SHP, "language" | "children">) => FC<SyntaxHighlighterProps>;
|
|
9
|
+
export declare const makeLightSyntaxHighlighter: (config: Omit<SHP, "language" | "children">) => FC<SyntaxHighlighterProps>;
|
|
10
|
+
export declare const makeLightAsyncSyntaxHighlighter: (config: Omit<SHP, "language" | "children">) => FC<SyntaxHighlighterProps>;
|
|
11
|
+
//# sourceMappingURL=react-syntax-highlighter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-syntax-highlighter.d.ts","sourceRoot":"","sources":["../src/react-syntax-highlighter.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAC/C,OAA0B,EAOxB,sBAAsB,IAAI,GAAG,EAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AA2B3E,eAAO,MAAM,qBAAqB,WAvBvB,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC,+BAwBC,CAAC;AAE/C,eAAO,MAAM,0BAA0B,WA1B5B,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC,+BA0B6B,CAAC;AAE3E,eAAO,MAAM,+BAA+B,WA5BjC,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC,+BA6BN,CAAC;AAExC,eAAO,MAAM,oCAAoC,WA/BtC,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC,+BAgCD,CAAC;AAE7C,eAAO,MAAM,+BAA+B,WAlCjC,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC,+BAmCN,CAAC;AAExC,eAAO,MAAM,0BAA0B,WArC5B,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC,+BAqC6B,CAAC;AAE3E,eAAO,MAAM,+BAA+B,WAvCjC,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC,+BAwCN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react-syntax-highlighter",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
+
"src",
|
|
16
17
|
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"sideEffects": false,
|
|
19
20
|
"peerDependencies": {
|
|
20
|
-
"@assistant-ui/react": "^0.10.
|
|
21
|
-
"@assistant-ui/react-markdown": "^0.10.
|
|
21
|
+
"@assistant-ui/react": "^0.10.1",
|
|
22
|
+
"@assistant-ui/react-markdown": "^0.10.1",
|
|
22
23
|
"@types/react": "*",
|
|
23
24
|
"@types/react-syntax-highlighter": "*",
|
|
24
25
|
"react": "^18 || ^19 || ^19.0.0-rc",
|
|
@@ -34,15 +35,15 @@
|
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/node": "^22.14.1",
|
|
37
|
-
"@types/react": "^19.1.
|
|
38
|
-
"@types/react-syntax-highlighter": "^15.5.
|
|
38
|
+
"@types/react": "^19.1.2",
|
|
39
|
+
"@types/react-syntax-highlighter": "^15.5.13",
|
|
39
40
|
"eslint": "^9",
|
|
40
41
|
"eslint-config-next": "15.3.1",
|
|
41
42
|
"react": "^19.1.0",
|
|
42
|
-
"react-syntax-highlighter": "^15.
|
|
43
|
+
"react-syntax-highlighter": "^15.6.1",
|
|
43
44
|
"tsx": "^4.19.3",
|
|
44
|
-
"@assistant-ui/react": "0.10.
|
|
45
|
-
"@assistant-ui/react-markdown": "0.10.
|
|
45
|
+
"@assistant-ui/react": "0.10.1",
|
|
46
|
+
"@assistant-ui/react-markdown": "0.10.1",
|
|
46
47
|
"@assistant-ui/tsbuildutils": "0.0.1",
|
|
47
48
|
"@assistant-ui/tsconfig": "0.0.0"
|
|
48
49
|
},
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"homepage": "https://www.assistant-ui.com/",
|
|
54
55
|
"repository": {
|
|
55
56
|
"type": "git",
|
|
56
|
-
"url": "
|
|
57
|
+
"url": "https://github.com/assistant-ui/assistant-ui/tree/main/packages/react-syntax-highlighter"
|
|
57
58
|
},
|
|
58
59
|
"bugs": {
|
|
59
60
|
"url": "https://github.com/assistant-ui/assistant-ui/issues"
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export {
|
|
2
|
+
makeSyntaxHighlighter,
|
|
3
|
+
makeLightSyntaxHighlighter,
|
|
4
|
+
makeLightAsyncSyntaxHighlighter,
|
|
5
|
+
makePrismSyntaxHighlighter,
|
|
6
|
+
makePrismLightSyntaxHighlighter,
|
|
7
|
+
makePrismAsyncSyntaxHighlighter,
|
|
8
|
+
makePrismAsyncLightSyntaxHighlighter,
|
|
9
|
+
} from "./react-syntax-highlighter";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentType, type FC } from "react";
|
|
4
|
+
import SyntaxHighlighter, {
|
|
5
|
+
Prism,
|
|
6
|
+
PrismAsync,
|
|
7
|
+
PrismAsyncLight,
|
|
8
|
+
PrismLight,
|
|
9
|
+
Light,
|
|
10
|
+
LightAsync,
|
|
11
|
+
SyntaxHighlighterProps as SHP,
|
|
12
|
+
} from "react-syntax-highlighter";
|
|
13
|
+
import type { SyntaxHighlighterProps } from "@assistant-ui/react-markdown";
|
|
14
|
+
|
|
15
|
+
const makeMakeSyntaxHighlighter =
|
|
16
|
+
(SyntaxHighlighter: ComponentType<SHP>) =>
|
|
17
|
+
(config: Omit<SHP, "language" | "children">) => {
|
|
18
|
+
const PrismSyntaxHighlighter: FC<SyntaxHighlighterProps> = ({
|
|
19
|
+
components: { Pre, Code },
|
|
20
|
+
language,
|
|
21
|
+
code,
|
|
22
|
+
}) => {
|
|
23
|
+
return (
|
|
24
|
+
<SyntaxHighlighter
|
|
25
|
+
PreTag={Pre}
|
|
26
|
+
CodeTag={Code}
|
|
27
|
+
{...config}
|
|
28
|
+
language={language}
|
|
29
|
+
>
|
|
30
|
+
{code}
|
|
31
|
+
</SyntaxHighlighter>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
PrismSyntaxHighlighter.displayName = "PrismSyntaxHighlighter";
|
|
36
|
+
|
|
37
|
+
return PrismSyntaxHighlighter;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const makeSyntaxHighlighter =
|
|
41
|
+
makeMakeSyntaxHighlighter(SyntaxHighlighter);
|
|
42
|
+
|
|
43
|
+
export const makePrismSyntaxHighlighter = makeMakeSyntaxHighlighter(Prism);
|
|
44
|
+
|
|
45
|
+
export const makePrismAsyncSyntaxHighlighter =
|
|
46
|
+
makeMakeSyntaxHighlighter(PrismAsync);
|
|
47
|
+
|
|
48
|
+
export const makePrismAsyncLightSyntaxHighlighter =
|
|
49
|
+
makeMakeSyntaxHighlighter(PrismAsyncLight);
|
|
50
|
+
|
|
51
|
+
export const makePrismLightSyntaxHighlighter =
|
|
52
|
+
makeMakeSyntaxHighlighter(PrismLight);
|
|
53
|
+
|
|
54
|
+
export const makeLightSyntaxHighlighter = makeMakeSyntaxHighlighter(Light);
|
|
55
|
+
|
|
56
|
+
export const makeLightAsyncSyntaxHighlighter =
|
|
57
|
+
makeMakeSyntaxHighlighter(LightAsync);
|