ink-markdown-es 1.0.0 → 1.0.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/types.d.ts +70 -0
- package/package.json +2 -2
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ReactNode, ComponentProps } from 'react';
|
|
2
|
+
import type { Token, Tokens } from 'marked';
|
|
3
|
+
import type { Text, Box } from 'ink';
|
|
4
|
+
export type TextStyleProps = Pick<ComponentProps<typeof Text>, 'color' | 'backgroundColor' | 'dimColor' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'inverse' | 'wrap'>;
|
|
5
|
+
export type BoxStyleProps = ComponentProps<typeof Box>;
|
|
6
|
+
export type HeadingStyleProps = TextStyleProps & BoxStyleProps & {
|
|
7
|
+
showSharp?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type ListItemStyleProps = TextStyleProps & BoxStyleProps & {
|
|
10
|
+
bullet?: string;
|
|
11
|
+
};
|
|
12
|
+
export type HrStyleProps = TextStyleProps & BoxStyleProps & {
|
|
13
|
+
char?: string;
|
|
14
|
+
width?: number;
|
|
15
|
+
};
|
|
16
|
+
export type BlockStyles = {
|
|
17
|
+
h1?: HeadingStyleProps;
|
|
18
|
+
h2?: HeadingStyleProps;
|
|
19
|
+
h3?: HeadingStyleProps;
|
|
20
|
+
h4?: HeadingStyleProps;
|
|
21
|
+
h5?: HeadingStyleProps;
|
|
22
|
+
h6?: HeadingStyleProps;
|
|
23
|
+
paragraph?: TextStyleProps & BoxStyleProps;
|
|
24
|
+
blockquote?: TextStyleProps & BoxStyleProps;
|
|
25
|
+
code?: TextStyleProps & BoxStyleProps;
|
|
26
|
+
codespan?: TextStyleProps;
|
|
27
|
+
list?: BoxStyleProps;
|
|
28
|
+
listItem?: ListItemStyleProps;
|
|
29
|
+
hr?: HrStyleProps;
|
|
30
|
+
link?: TextStyleProps;
|
|
31
|
+
strong?: TextStyleProps;
|
|
32
|
+
em?: TextStyleProps;
|
|
33
|
+
del?: TextStyleProps;
|
|
34
|
+
image?: TextStyleProps;
|
|
35
|
+
table?: BoxStyleProps;
|
|
36
|
+
tableCell?: TextStyleProps & BoxStyleProps;
|
|
37
|
+
};
|
|
38
|
+
export type BlockRenderers = {
|
|
39
|
+
h1?: (text: string, token: Tokens.Heading) => ReactNode;
|
|
40
|
+
h2?: (text: string, token: Tokens.Heading) => ReactNode;
|
|
41
|
+
h3?: (text: string, token: Tokens.Heading) => ReactNode;
|
|
42
|
+
h4?: (text: string, token: Tokens.Heading) => ReactNode;
|
|
43
|
+
h5?: (text: string, token: Tokens.Heading) => ReactNode;
|
|
44
|
+
h6?: (text: string, token: Tokens.Heading) => ReactNode;
|
|
45
|
+
paragraph?: (content: ReactNode, token: Tokens.Paragraph) => ReactNode;
|
|
46
|
+
code?: (code: string, language: string | undefined, token: Tokens.Code) => ReactNode;
|
|
47
|
+
list?: (items: ReactNode[], ordered: boolean, token: Tokens.List) => ReactNode;
|
|
48
|
+
listItem?: (content: ReactNode, token: Tokens.ListItem) => ReactNode;
|
|
49
|
+
blockquote?: (content: ReactNode, token: Tokens.Blockquote) => ReactNode;
|
|
50
|
+
hr?: (token: Tokens.Hr) => ReactNode;
|
|
51
|
+
link?: (text: string, href: string, title: string | null | undefined, token: Tokens.Link) => ReactNode;
|
|
52
|
+
image?: (alt: string, src: string, title: string | null, token: Tokens.Image) => ReactNode;
|
|
53
|
+
codespan?: (code: string, token: Tokens.Codespan) => ReactNode;
|
|
54
|
+
strong?: (content: ReactNode, token: Tokens.Strong) => ReactNode;
|
|
55
|
+
em?: (content: ReactNode, token: Tokens.Em) => ReactNode;
|
|
56
|
+
del?: (content: ReactNode, token: Tokens.Del) => ReactNode;
|
|
57
|
+
table?: (header: ReactNode, body: ReactNode, token: Tokens.Table) => ReactNode;
|
|
58
|
+
};
|
|
59
|
+
export type MarkdownProps = {
|
|
60
|
+
children: string;
|
|
61
|
+
styles?: BlockStyles;
|
|
62
|
+
renderers?: BlockRenderers;
|
|
63
|
+
showSharp?: boolean;
|
|
64
|
+
};
|
|
65
|
+
export type MemoizedBlockProps = {
|
|
66
|
+
token: Token;
|
|
67
|
+
styles: BlockStyles;
|
|
68
|
+
renderers: BlockRenderers;
|
|
69
|
+
showSharp: boolean;
|
|
70
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ink-markdown-es",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A modern performance markdown renderer for ink",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"ink": "^6",
|
|
49
|
-
"react": "^19"
|
|
49
|
+
"react": "^18 || ^19"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"dedent": "^1.7.1",
|