md-editor-v3 1.11.13 → 2.0.0-beta.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.
@@ -1,3 +1,4 @@
1
+ import type { marked, Renderer } from 'marked';
1
2
  declare global {
2
3
  interface Window {
3
4
  hljs: any;
@@ -6,6 +7,7 @@ declare global {
6
7
  Cropper: any;
7
8
  screenfull: any;
8
9
  mermaid: any;
10
+ katex: any;
9
11
  }
10
12
  }
11
13
  export interface ToolbarTips {
@@ -98,18 +100,122 @@ export interface SettingType {
98
100
  htmlPreview: boolean;
99
101
  }
100
102
  export declare type Themes = 'light' | 'dark';
101
- export declare type PreviewThemes = 'default' | 'github' | 'vuepress';
103
+ export declare type PreviewThemes = string;
102
104
  export interface HeadList {
103
105
  text: string;
104
106
  level: 1 | 2 | 3 | 4 | 5 | 6;
105
107
  }
106
- export declare type MarkedHeading = (text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string, slugger: {
107
- seen: {
108
- [slugValue: string]: number;
109
- };
110
- slug(value: string, options?: {
111
- dryrun: boolean;
112
- }): string;
113
- }) => string;
114
108
  export declare type MarkedHeadingId = (text: string, level: number) => string;
115
- export declare type MarkedImage = (href: string, title: string, desc: string) => string;
109
+ export interface MermaidTemplate {
110
+ /**
111
+ * 流程图
112
+ */
113
+ flow?: string;
114
+ /**
115
+ * 时序图
116
+ */
117
+ sequence?: string;
118
+ /**
119
+ * 甘特图
120
+ */
121
+ gantt?: string;
122
+ /**
123
+ * 类图
124
+ */
125
+ class?: string;
126
+ /**
127
+ * 状态图
128
+ */
129
+ state?: string;
130
+ /**
131
+ * 饼图
132
+ */
133
+ pie?: string;
134
+ /**
135
+ * 关系图
136
+ */
137
+ relationship?: string;
138
+ /**
139
+ * 旅程图
140
+ */
141
+ journey?: string;
142
+ }
143
+ export interface ConfigOption {
144
+ /**
145
+ * 覆盖编辑器默认的renderer属性
146
+ * @see https://marked.js.org/using_pro#renderer
147
+ */
148
+ markedRenderer?: (renderer: Renderer) => Renderer;
149
+ /**
150
+ * 自定义 marked 扩展
151
+ * @see https://marked.js.org/using_pro#extensions
152
+ */
153
+ markedExtensions?: Array<marked.TokenizerExtension & marked.RendererExtension>;
154
+ /**
155
+ * 自定义 marked option,不推荐在这么覆盖renderer,这会导致内部逻辑混乱!
156
+ * @see https://marked.js.org/using_advanced#options
157
+ */
158
+ markedOptions?: marked.MarkedOptions;
159
+ /**
160
+ * 编辑器内部依赖库
161
+ */
162
+ editorExtensions?: {
163
+ highlight?: {
164
+ instance?: any;
165
+ js?: string;
166
+ css?: CodeCss;
167
+ };
168
+ prettier?: {
169
+ standaloneJs?: string;
170
+ parserMarkdownJs?: string;
171
+ };
172
+ cropper?: {
173
+ instance?: any;
174
+ js?: string;
175
+ css?: string;
176
+ };
177
+ iconfont?: string;
178
+ screenfull?: {
179
+ instance?: any;
180
+ js?: string;
181
+ };
182
+ mermaid?: {
183
+ instance?: any;
184
+ js?: string;
185
+ };
186
+ katex?: {
187
+ instance?: any;
188
+ js?: string;
189
+ css?: string;
190
+ };
191
+ };
192
+ editorConfig?: {
193
+ /**
194
+ * 自定义提示语言
195
+ */
196
+ languageUserDefined?: {
197
+ [key: string]: StaticTextDefaultValue;
198
+ };
199
+ /**
200
+ * 自定义内部mermaid模块
201
+ */
202
+ mermaidTemplate?: MermaidTemplate;
203
+ };
204
+ }
205
+ /**
206
+ * 扩展编辑器内部功能,包括marked和一些内部依赖实例,如highlight、cropper等
207
+ */
208
+ export declare type Config = (options: ConfigOption) => void;
209
+ /**
210
+ * 编辑器操作潜在的错误
211
+ */
212
+ export interface InnerError {
213
+ name: string;
214
+ message: string;
215
+ }
216
+ export interface CodeCss {
217
+ [key: string]: {
218
+ light: string;
219
+ dark: string;
220
+ };
221
+ }
@@ -0,0 +1,3 @@
1
+ import { Config } from '../type';
2
+ declare const config: Config;
3
+ export default config;