github-markdown-editor 1.0.2 → 1.0.3
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/MarkdownEditor.d.ts +3 -2
- package/dist/MarkdownEditor.d.ts.map +1 -1
- package/dist/MarkdownEditor.stories.d.ts +19 -0
- package/dist/MarkdownEditor.stories.d.ts.map +1 -0
- package/dist/Toolbar.d.ts +0 -1
- package/dist/{style.css → github-markdown-editor.css} +1 -1
- package/dist/index-B7XeA-H5.mjs +28389 -0
- package/dist/index-Cm7XpaMD.mjs +49171 -0
- package/dist/index-DdLhXJh6.js +121 -0
- package/dist/index-Dqi1bR-_.js +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +10 -28178
- package/dist/index.js +1 -121
- package/dist/markdown.d.ts +3 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/stories/Button.d.ts +15 -0
- package/dist/stories/Button.d.ts.map +1 -0
- package/dist/stories/Button.stories.d.ts +24 -0
- package/dist/stories/Button.stories.d.ts.map +1 -0
- package/dist/stories/Header.d.ts +12 -0
- package/dist/stories/Header.d.ts.map +1 -0
- package/dist/stories/Header.stories.d.ts +19 -0
- package/dist/stories/Header.stories.d.ts.map +1 -0
- package/dist/stories/Page.d.ts +3 -0
- package/dist/stories/Page.d.ts.map +1 -0
- package/dist/stories/Page.stories.d.ts +13 -0
- package/dist/stories/Page.stories.d.ts.map +1 -0
- package/dist/syntaxHighlighting.d.ts +14 -0
- package/dist/syntaxHighlighting.d.ts.map +1 -0
- package/dist/themes.d.ts +9 -0
- package/dist/themes.d.ts.map +1 -0
- package/package.json +70 -55
package/dist/markdown.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts Markdown text to HTML using remark with GitHub Flavored Markdown support
|
|
3
3
|
* @param markdown - The markdown text to convert
|
|
4
|
+
* @param codeBlockTheme - Optional theme name for syntax highlighting (e.g., 'github', 'monokai', 'dracula')
|
|
5
|
+
* @param editorTheme - Editor theme to determine default syntax theme if codeBlockTheme is not provided
|
|
4
6
|
* @returns Promise resolving to HTML string
|
|
5
7
|
*/
|
|
6
|
-
export declare function convertMarkdownToHtml(markdown: string): Promise<string>;
|
|
8
|
+
export declare function convertMarkdownToHtml(markdown: string, codeBlockTheme?: string, editorTheme?: string): Promise<string>;
|
|
7
9
|
/**
|
|
8
10
|
* Extracts frontmatter from markdown if present
|
|
9
11
|
* @param markdown - The markdown text
|
package/dist/markdown.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAwBjB;AA8CD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG;IACpD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB,CAoBA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ButtonProps {
|
|
2
|
+
/** Is this the principal call to action on the page? */
|
|
3
|
+
primary?: boolean;
|
|
4
|
+
/** What background color to use */
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
/** How large should the button be? */
|
|
7
|
+
size?: 'small' | 'medium' | 'large';
|
|
8
|
+
/** Button contents */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Optional click handler */
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
/** Primary UI component for user interaction */
|
|
14
|
+
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/stories/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mCAAmC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gDAAgD;AAChD,eAAO,MAAM,MAAM,GAAI,qDAMpB,WAAW,4CAYb,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ primary, size, backgroundColor, label, ...props }: import('./Button').ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
backgroundColor: {
|
|
11
|
+
control: "color";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
args: {
|
|
15
|
+
onClick: import('@vitest/spy').Mock<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
export declare const Primary: Story;
|
|
21
|
+
export declare const Secondary: Story;
|
|
22
|
+
export declare const Large: Story;
|
|
23
|
+
export declare const Small: Story;
|
|
24
|
+
//# sourceMappingURL=Button.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Button.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAO5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;CAeqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAIvB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type User = {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
export interface HeaderProps {
|
|
5
|
+
user?: User;
|
|
6
|
+
onLogin?: () => void;
|
|
7
|
+
onLogout?: () => void;
|
|
8
|
+
onCreateAccount?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const Header: ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/stories/Header.tsx"],"names":[],"mappings":"AAGA,OAAO,cAAc,CAAC;AAEtB,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,MAAM,GAAI,8CAA8C,WAAW,4CAuC/E,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ user, onLogin, onLogout, onCreateAccount }: import('./Header').HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
args: {
|
|
10
|
+
onLogin: import('@vitest/spy').Mock<(...args: any[]) => any>;
|
|
11
|
+
onLogout: import('@vitest/spy').Mock<(...args: any[]) => any>;
|
|
12
|
+
onCreateAccount: import('@vitest/spy').Mock<(...args: any[]) => any>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
export declare const LoggedIn: Story;
|
|
18
|
+
export declare const LoggedOut: Story;
|
|
19
|
+
//# sourceMappingURL=Header.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Header.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,QAAA,MAAM,IAAI;;;;;;;;;;;;CAcqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../src/stories/Page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,YAAY,CAAC;AAMpB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EA+DxB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import('react').FC<{}>;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const LoggedOut: Story;
|
|
12
|
+
export declare const LoggedIn: Story;
|
|
13
|
+
//# sourceMappingURL=Page.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Page.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,QAAA,MAAM,IAAI;;;;;;CAOmB,CAAC;AAE9B,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,SAAS,EAAE,KAAU,CAAC;AAGnC,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available syntax highlighting themes for code blocks
|
|
3
|
+
*/
|
|
4
|
+
export type SyntaxHighlightTheme = 'github' | 'github-dark' | 'monokai' | 'dracula' | 'solarized-light' | 'solarized-dark' | 'vs' | 'vs2015' | 'atom-one-light' | 'atom-one-dark' | 'default';
|
|
5
|
+
/**
|
|
6
|
+
* Load highlight.js theme CSS dynamically
|
|
7
|
+
* @param theme - Theme name
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadHighlightTheme(theme?: SyntaxHighlightTheme): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Get default theme based on editor theme
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDefaultSyntaxTheme(editorTheme: string): SyntaxHighlightTheme;
|
|
14
|
+
//# sourceMappingURL=syntaxHighlighting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntaxHighlighting.d.ts","sourceRoot":"","sources":["../src/syntaxHighlighting.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,QAAQ,GACR,aAAa,GACb,SAAS,GACT,SAAS,GACT,iBAAiB,GACjB,gBAAgB,GAChB,IAAI,GACJ,QAAQ,GACR,gBAAgB,GAChB,eAAe,GACf,SAAS,CAAC;AAEd;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,GAAE,oBAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB9F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,oBAAoB,CAW/E"}
|
package/dist/themes.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme configuration for CodeMirror editor
|
|
3
|
+
*/
|
|
4
|
+
export type ThemeType = 'light' | 'dark' | 'github-dark' | 'monokai' | 'solarized-light' | 'solarized-dark';
|
|
5
|
+
/**
|
|
6
|
+
* Get CodeMirror theme extension based on theme type
|
|
7
|
+
*/
|
|
8
|
+
export declare function getThemeExtension(theme: ThemeType): any;
|
|
9
|
+
//# sourceMappingURL=themes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../src/themes.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAE5G;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,OAsKjD"}
|
package/package.json
CHANGED
|
@@ -1,63 +1,78 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"name": "github-markdown-editor",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "A modern GitHub-like Markdown editor built with CodeMirror 6",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.esm.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"import": "./dist/index.esm.js",
|
|
11
|
-
"require": "./dist/index.js"
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"./style.css": "./dist/style.css"
|
|
15
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
|
-
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "tsc && vite build",
|
|
22
|
+
"prepublishOnly": "npm run build",
|
|
23
|
+
"example": "vite --config example/vite.config.ts",
|
|
24
|
+
"example:dev": "vite --config example/vite.config.ts",
|
|
25
|
+
"storybook": "storybook dev -p 6006",
|
|
26
|
+
"build-storybook": "storybook build"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"markdown",
|
|
30
|
+
"editor",
|
|
31
|
+
"codemirror",
|
|
32
|
+
"github",
|
|
33
|
+
"gfm",
|
|
34
|
+
"react",
|
|
35
|
+
"typescript"
|
|
36
|
+
],
|
|
37
|
+
"author": "Your Name",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": ">=16.8.0",
|
|
41
|
+
"react-dom": ">=16.8.0"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@codemirror/commands": "^6.3.3",
|
|
45
|
+
"@codemirror/lang-markdown": "^6.2.4",
|
|
46
|
+
"@codemirror/language": "^6.10.0",
|
|
47
|
+
"@codemirror/state": "^6.4.0",
|
|
48
|
+
"@codemirror/view": "^6.23.0",
|
|
49
|
+
"highlight.js": "^11.10.0",
|
|
50
|
+
"remark": "^15.0.1",
|
|
51
|
+
"remark-gfm": "^4.0.0",
|
|
52
|
+
"remark-html": "^16.0.1",
|
|
53
|
+
"remark-parse": "^11.0.0",
|
|
54
|
+
"unified": "^11.0.4"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
58
|
+
"@storybook/addon-a11y": "^10.1.11",
|
|
59
|
+
"@storybook/addon-docs": "^10.1.11",
|
|
60
|
+
"@storybook/addon-onboarding": "^10.1.11",
|
|
61
|
+
"@storybook/addon-vitest": "^10.1.11",
|
|
62
|
+
"@storybook/react-vite": "^10.1.11",
|
|
63
|
+
"@types/highlight.js": "^10.1.0",
|
|
64
|
+
"@types/react": "^18.2.48",
|
|
65
|
+
"@types/react-dom": "^18.2.18",
|
|
66
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
67
|
+
"@vitest/browser-playwright": "^4.0.16",
|
|
68
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
69
|
+
"playwright": "^1.57.0",
|
|
70
|
+
"react": "^18.2.0",
|
|
71
|
+
"react-dom": "^18.2.0",
|
|
72
|
+
"storybook": "^10.1.11",
|
|
73
|
+
"typescript": "^5.3.3",
|
|
74
|
+
"vite": "^7.3.0",
|
|
75
|
+
"vite-plugin-dts": "^4.5.4",
|
|
76
|
+
"vitest": "^4.0.16"
|
|
77
|
+
}
|
|
63
78
|
}
|