x-star-editor 0.1.1 → 0.2.0
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/components/Fade.js +2 -7
- package/dist/components/FileInput.js +2 -10
- package/dist/components/Toolbar.js +17 -24
- package/dist/locales/index.js +6 -5
- package/dist/styles/index.css +52 -45
- package/dist/types/worker.js.d.ts +3 -0
- package/dist/utils/container.js +1 -3
- package/dist/utils/handler.js +230 -87
- package/dist/utils/history.js +3 -16
- package/dist/utils/markdown.d.ts +31 -29
- package/dist/utils/markdown.js +106 -62
- package/dist/x-star-editor/index.d.ts +21 -7
- package/dist/x-star-editor/index.js +20 -34
- package/dist/x-star-md-editor/index.d.ts +5 -1
- package/dist/x-star-md-editor/index.js +82 -53
- package/dist/x-star-md-viewer/index.d.ts +27 -2
- package/dist/x-star-md-viewer/index.js +52 -10
- package/package.json +6 -2
- package/workers-dist/markdown.worker.js +1 -0
- /package/dist/{utils → types}/jsx-runtime.d.ts +0 -0
package/dist/utils/handler.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
+
import { createKeybindingsHandler } from 'tinykeys';
|
|
4
3
|
import { createSelection, getRange } from "./container";
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -92,111 +91,255 @@ export var selectHandler = function selectHandler(selection) {
|
|
|
92
91
|
*/
|
|
93
92
|
|
|
94
93
|
export var getDefaultKeyboardEventHandlers = function getDefaultKeyboardEventHandlers() {
|
|
95
|
-
return [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var selection = _ref8.selection,
|
|
94
|
+
return [function (_ref8) {
|
|
95
|
+
var sourceCode = _ref8.sourceCode,
|
|
96
|
+
selection = _ref8.selection,
|
|
99
97
|
dispatch = _ref8.dispatch,
|
|
100
98
|
e = _ref8.e;
|
|
101
|
-
|
|
102
|
-
e
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
e
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
99
|
+
return createKeybindingsHandler({
|
|
100
|
+
Tab: function Tab(e) {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
dispatch({
|
|
103
|
+
type: 'insert',
|
|
104
|
+
payload: {
|
|
105
|
+
text: '\t'
|
|
106
|
+
},
|
|
107
|
+
selection: selection
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
Backspace: function Backspace(e) {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
dispatch({
|
|
113
|
+
type: 'delete',
|
|
114
|
+
payload: {
|
|
115
|
+
direction: 'backward',
|
|
116
|
+
boundary: 'char'
|
|
117
|
+
},
|
|
118
|
+
selection: selection
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
'$mod+Backspace': function $modBackspace(e) {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
dispatch({
|
|
124
|
+
type: 'delete',
|
|
125
|
+
payload: {
|
|
126
|
+
direction: 'backward',
|
|
127
|
+
boundary: 'line'
|
|
128
|
+
},
|
|
129
|
+
selection: selection
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
'Shift+Backspace': function ShiftBackspace(e) {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
dispatch({
|
|
135
|
+
type: 'delete',
|
|
136
|
+
payload: {
|
|
137
|
+
direction: 'backward',
|
|
138
|
+
boundary: 'char'
|
|
139
|
+
},
|
|
140
|
+
selection: selection
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
'Meta+Backspace': function MetaBackspace(e) {
|
|
144
|
+
return e.preventDefault();
|
|
145
|
+
},
|
|
146
|
+
'Alt+Backspace': function AltBackspace(e) {
|
|
147
|
+
return e.preventDefault();
|
|
148
|
+
},
|
|
149
|
+
'Control+Backspace': function ControlBackspace(e) {
|
|
150
|
+
return e.preventDefault();
|
|
151
|
+
},
|
|
152
|
+
'Shift+Meta+Backspace': function ShiftMetaBackspace(e) {
|
|
153
|
+
return e.preventDefault();
|
|
154
|
+
},
|
|
155
|
+
'Shift+Alt+Backspace': function ShiftAltBackspace(e) {
|
|
156
|
+
return e.preventDefault();
|
|
157
|
+
},
|
|
158
|
+
'Shift+Control+Backspace': function ShiftControlBackspace(e) {
|
|
159
|
+
return e.preventDefault();
|
|
160
|
+
},
|
|
161
|
+
'Meta+Alt+Backspace': function MetaAltBackspace(e) {
|
|
162
|
+
return e.preventDefault();
|
|
163
|
+
},
|
|
164
|
+
'Meta+Control+Backspace': function MetaControlBackspace(e) {
|
|
165
|
+
return e.preventDefault();
|
|
166
|
+
},
|
|
167
|
+
'Alt+Control+Backspace': function AltControlBackspace(e) {
|
|
168
|
+
return e.preventDefault();
|
|
169
|
+
},
|
|
170
|
+
'Shift+Meta+Alt+Backspace': function ShiftMetaAltBackspace(e) {
|
|
171
|
+
return e.preventDefault();
|
|
172
|
+
},
|
|
173
|
+
'Shift+Meta+Control+Backspace': function ShiftMetaControlBackspace(e) {
|
|
174
|
+
return e.preventDefault();
|
|
175
|
+
},
|
|
176
|
+
'Shift+Alt+Control+Backspace': function ShiftAltControlBackspace(e) {
|
|
177
|
+
return e.preventDefault();
|
|
178
|
+
},
|
|
179
|
+
'Meta+Alt+Control+Backspace': function MetaAltControlBackspace(e) {
|
|
180
|
+
return e.preventDefault();
|
|
181
|
+
},
|
|
182
|
+
Delete: function Delete(e) {
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
dispatch({
|
|
185
|
+
type: 'delete',
|
|
186
|
+
payload: {
|
|
187
|
+
direction: 'forward',
|
|
188
|
+
boundary: 'char'
|
|
189
|
+
},
|
|
190
|
+
selection: selection
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
'$mod+Delete': function $modDelete(e) {
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
dispatch({
|
|
196
|
+
type: 'delete',
|
|
197
|
+
payload: {
|
|
198
|
+
direction: 'forward',
|
|
199
|
+
boundary: 'line'
|
|
200
|
+
},
|
|
201
|
+
selection: selection
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
'Shift+Delete': function ShiftDelete(e) {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
dispatch({
|
|
207
|
+
type: 'delete',
|
|
208
|
+
payload: {
|
|
209
|
+
direction: 'forward',
|
|
210
|
+
boundary: 'char'
|
|
211
|
+
},
|
|
212
|
+
selection: selection
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
'Meta+Delete': function MetaDelete(e) {
|
|
216
|
+
return e.preventDefault();
|
|
217
|
+
},
|
|
218
|
+
'Alt+Delete': function AltDelete(e) {
|
|
219
|
+
return e.preventDefault();
|
|
220
|
+
},
|
|
221
|
+
'Control+Delete': function ControlDelete(e) {
|
|
222
|
+
return e.preventDefault();
|
|
223
|
+
},
|
|
224
|
+
'Shift+Meta+Delete': function ShiftMetaDelete(e) {
|
|
225
|
+
return e.preventDefault();
|
|
226
|
+
},
|
|
227
|
+
'Shift+Alt+Delete': function ShiftAltDelete(e) {
|
|
228
|
+
return e.preventDefault();
|
|
229
|
+
},
|
|
230
|
+
'Shift+Control+Delete': function ShiftControlDelete(e) {
|
|
231
|
+
return e.preventDefault();
|
|
232
|
+
},
|
|
233
|
+
'Meta+Alt+Delete': function MetaAltDelete(e) {
|
|
234
|
+
return e.preventDefault();
|
|
235
|
+
},
|
|
236
|
+
'Meta+Control+Delete': function MetaControlDelete(e) {
|
|
237
|
+
return e.preventDefault();
|
|
238
|
+
},
|
|
239
|
+
'Alt+Control+Delete': function AltControlDelete(e) {
|
|
240
|
+
return e.preventDefault();
|
|
241
|
+
},
|
|
242
|
+
'Shift+Meta+Alt+Delete': function ShiftMetaAltDelete(e) {
|
|
243
|
+
return e.preventDefault();
|
|
244
|
+
},
|
|
245
|
+
'Shift+Meta+Control+Delete': function ShiftMetaControlDelete(e) {
|
|
246
|
+
return e.preventDefault();
|
|
247
|
+
},
|
|
248
|
+
'Shift+Alt+Control+Delete': function ShiftAltControlDelete(e) {
|
|
249
|
+
return e.preventDefault();
|
|
250
|
+
},
|
|
251
|
+
'Meta+Alt+Control+Delete': function MetaAltControlDelete(e) {
|
|
252
|
+
return e.preventDefault();
|
|
253
|
+
},
|
|
254
|
+
'$mod+KeyI': function $modKeyI(e) {
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
dispatch({
|
|
257
|
+
type: 'toggle',
|
|
258
|
+
payload: {
|
|
259
|
+
type: 'emphasis'
|
|
260
|
+
},
|
|
261
|
+
selection: selection
|
|
262
|
+
});
|
|
263
|
+
},
|
|
264
|
+
'$mod+KeyB': function $modKeyB(e) {
|
|
265
|
+
e.preventDefault();
|
|
266
|
+
dispatch({
|
|
267
|
+
type: 'toggle',
|
|
268
|
+
payload: {
|
|
269
|
+
type: 'strong'
|
|
270
|
+
},
|
|
271
|
+
selection: selection
|
|
272
|
+
});
|
|
273
|
+
},
|
|
274
|
+
'$mod+KeyZ': function $modKeyZ(e) {
|
|
275
|
+
e.preventDefault();
|
|
276
|
+
dispatch({
|
|
277
|
+
type: 'undo'
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
'$mod+KeyY': function $modKeyY(e) {
|
|
281
|
+
e.preventDefault();
|
|
282
|
+
dispatch({
|
|
283
|
+
type: 'redo'
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
ArrowLeft: function ArrowLeft(e) {
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
var _getRange = getRange(selection),
|
|
289
|
+
startOffset = _getRange.startOffset,
|
|
290
|
+
endOffset = _getRange.endOffset;
|
|
291
|
+
if (startOffset < endOffset) {
|
|
171
292
|
dispatch({
|
|
172
293
|
type: 'select',
|
|
173
|
-
selection: createSelection(
|
|
294
|
+
selection: createSelection(startOffset)
|
|
174
295
|
});
|
|
175
|
-
} else if (
|
|
296
|
+
} else if (startOffset) {
|
|
176
297
|
dispatch({
|
|
177
298
|
type: 'select',
|
|
178
|
-
selection: createSelection(
|
|
299
|
+
selection: createSelection(startOffset - 1)
|
|
179
300
|
});
|
|
180
301
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
302
|
+
},
|
|
303
|
+
'Shift+ArrowLeft': function ShiftArrowLeft(e) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
var anchorOffset = selection.anchorOffset,
|
|
306
|
+
focusOffset = selection.focusOffset;
|
|
307
|
+
if (focusOffset) {
|
|
183
308
|
dispatch({
|
|
184
309
|
type: 'select',
|
|
185
|
-
selection: createSelection(
|
|
310
|
+
selection: createSelection(anchorOffset, focusOffset - 1)
|
|
186
311
|
});
|
|
187
|
-
}
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
ArrowRight: function ArrowRight(e) {
|
|
315
|
+
e.preventDefault();
|
|
316
|
+
var _getRange2 = getRange(selection),
|
|
317
|
+
startOffset = _getRange2.startOffset,
|
|
318
|
+
endOffset = _getRange2.endOffset;
|
|
319
|
+
if (startOffset < endOffset) {
|
|
188
320
|
dispatch({
|
|
189
321
|
type: 'select',
|
|
190
|
-
selection: createSelection(
|
|
322
|
+
selection: createSelection(endOffset)
|
|
191
323
|
});
|
|
192
|
-
} else if (
|
|
324
|
+
} else if (startOffset < sourceCode.length) {
|
|
193
325
|
dispatch({
|
|
194
326
|
type: 'select',
|
|
195
327
|
selection: createSelection(startOffset + 1)
|
|
196
328
|
});
|
|
197
329
|
}
|
|
330
|
+
},
|
|
331
|
+
'Shift+ArrowRight': function ShiftArrowRight(e) {
|
|
332
|
+
e.preventDefault();
|
|
333
|
+
var anchorOffset = selection.anchorOffset,
|
|
334
|
+
focusOffset = selection.focusOffset;
|
|
335
|
+
if (focusOffset < sourceCode.length) {
|
|
336
|
+
dispatch({
|
|
337
|
+
type: 'select',
|
|
338
|
+
selection: createSelection(anchorOffset, focusOffset + 1)
|
|
339
|
+
});
|
|
340
|
+
}
|
|
198
341
|
}
|
|
199
|
-
}
|
|
342
|
+
})(e.nativeEvent);
|
|
200
343
|
}];
|
|
201
344
|
};
|
|
202
345
|
|
package/dist/utils/history.js
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
5
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
17
4
|
import { useReducer } from 'react';
|
|
18
5
|
import { createSelection, getRange } from "./container";
|
|
19
6
|
|
package/dist/utils/markdown.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { Components } from 'hast-util-to-jsx-runtime';
|
|
3
2
|
import { defaultSchema } from 'rehype-sanitize';
|
|
4
|
-
type
|
|
5
|
-
export declare const getDefaultSchema: () => Schema;
|
|
6
|
-
/**
|
|
7
|
-
* 将 Markdown 文本解析为 Mdast 树并转换为 Hast 树的处理器
|
|
8
|
-
*/
|
|
9
|
-
declare const processor: import("unified").FrozenProcessor<import("mdast").Root, import("hast").Root, import("hast").Root, void>;
|
|
10
|
-
/**
|
|
11
|
-
* Mdast 节点
|
|
12
|
-
*/
|
|
13
|
-
export type MdastNode = ReturnType<(typeof processor)['parse']>['children'][number];
|
|
3
|
+
import type { ViewerOptions } from '../x-star-md-viewer';
|
|
14
4
|
/**
|
|
15
5
|
* 将 Markdown 文本映射到 DOM 树,第一层为 `<div>` 块元素,第二层为 `<div>` 行元素,之后均为 `<span>` 元素
|
|
16
6
|
*
|
|
@@ -18,30 +8,42 @@ export type MdastNode = ReturnType<(typeof processor)['parse']>['children'][numb
|
|
|
18
8
|
* @returns DOM 树
|
|
19
9
|
*/
|
|
20
10
|
export declare const editorRender: (sourceCode: string) => HTMLDivElement;
|
|
21
|
-
export interface ViewerOptions {
|
|
22
|
-
/**
|
|
23
|
-
* 自定义过滤模式
|
|
24
|
-
*/
|
|
25
|
-
customSchema: Schema;
|
|
26
|
-
/**
|
|
27
|
-
* 自定义 HTML 元素
|
|
28
|
-
*/
|
|
29
|
-
customHTMLElements: Partial<Components>;
|
|
30
|
-
/**
|
|
31
|
-
* 自定义块
|
|
32
|
-
*/
|
|
33
|
-
customBlocks: Partial<Record<string, React.ComponentType<{
|
|
34
|
-
children: string;
|
|
35
|
-
}>>>;
|
|
36
|
-
}
|
|
37
11
|
/**
|
|
38
|
-
* 将
|
|
12
|
+
* 将 Mdast 树转成 Hast 树的处理器
|
|
13
|
+
*/
|
|
14
|
+
declare const toHastProcessor: import("unified").FrozenProcessor<import("mdast").Root, import("hast").Root, import("hast").Root, void>;
|
|
15
|
+
/**
|
|
16
|
+
* Hast 根节点
|
|
17
|
+
*/
|
|
18
|
+
export type HastRoot = ReturnType<(typeof toHastProcessor)['runSync']>;
|
|
19
|
+
/**
|
|
20
|
+
* 将 Markdown 文本转成 Hast 树
|
|
39
21
|
*
|
|
40
22
|
* @param sourceCode Markdown 文本
|
|
23
|
+
* @returns Hast 树
|
|
24
|
+
*/
|
|
25
|
+
export declare const preViewerRender: (sourceCode: string) => import("hast").Root;
|
|
26
|
+
/**
|
|
27
|
+
* 过滤模式
|
|
28
|
+
*/
|
|
29
|
+
export type Schema = typeof defaultSchema;
|
|
30
|
+
export declare const getDefaultSchema: () => Schema;
|
|
31
|
+
/**
|
|
32
|
+
* 将 Hast 树转成新的 Hast 树
|
|
33
|
+
*
|
|
34
|
+
* @param root Hast 树
|
|
35
|
+
* @param schema 过滤模式
|
|
36
|
+
* @returns 新的 Hast 树
|
|
37
|
+
*/
|
|
38
|
+
export declare const viewerRender: (root: HastRoot, schema: Schema) => import("hast").Root;
|
|
39
|
+
/**
|
|
40
|
+
* 将 Hast 树映射到 React 虚拟 DOM 树
|
|
41
|
+
*
|
|
42
|
+
* @param root Hast 树
|
|
41
43
|
* @param options 配置项
|
|
42
44
|
* @returns React 虚拟 DOM 树
|
|
43
45
|
*/
|
|
44
|
-
export declare const
|
|
46
|
+
export declare const postViewerRender: (root: HastRoot, options: ViewerOptions) => JSX.Element;
|
|
45
47
|
/**
|
|
46
48
|
* 将 Markdown 文本转成 HTML 文本
|
|
47
49
|
*
|