markmap-lib 0.11.6 → 0.12.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/types/types.d.ts CHANGED
@@ -1,32 +1,53 @@
1
- import { CSSItem, JSItem, INode } from 'markmap-common';
2
- import { createTransformHooks } from './plugins/base';
3
- export declare type ITransformHooks = ReturnType<typeof createTransformHooks>;
4
- export interface IAssets {
5
- styles?: CSSItem[];
6
- scripts?: JSItem[];
7
- }
8
- export interface IMarkmapCreateOptions {
9
- /**
10
- * Markdown content as string.
11
- */
12
- content?: string;
13
- /**
14
- * Output file path of the markmap HTML file.
15
- * If not provided, the same basename as the Markdown input file will be used.
16
- */
17
- output?: string;
18
- }
19
- export interface IAssetsMap {
20
- [key: string]: IAssets;
21
- }
22
- export interface IFeatures {
23
- [key: string]: boolean;
24
- }
25
- export interface ITransformResult {
26
- root: INode;
27
- features: IFeatures;
28
- }
29
- export interface ITransformPlugin {
30
- name: string;
31
- transform: (transformHooks: ITransformHooks) => IAssets;
32
- }
1
+ import type { Remarkable } from 'remarkable';
2
+ import { CSSItem, JSItem, INode, IWrapContext, Hook } from 'markmap-common';
3
+ export interface ITransformHooks {
4
+ /**
5
+ * Tapped once when the parser is created.
6
+ */
7
+ parser: Hook<[md: Remarkable]>;
8
+ /**
9
+ * Tapped every time when Markdown content is transformed.
10
+ */
11
+ transform: Hook<[md: Remarkable, context: ITransformContext]>;
12
+ /**
13
+ * Tapped when Remarkable renders an HTML tag in Markdown.
14
+ */
15
+ htmltag: Hook<[ctx: IWrapContext<any>]>;
16
+ /**
17
+ * Indicate that the last transformation is not complete for reasons like
18
+ * lack of resources and is called when it is ready for a new transformation.
19
+ */
20
+ retransform: Hook<[]>;
21
+ }
22
+ export interface IAssets {
23
+ styles?: CSSItem[];
24
+ scripts?: JSItem[];
25
+ }
26
+ export interface IMarkmapCreateOptions {
27
+ /**
28
+ * Markdown content as string.
29
+ */
30
+ content?: string;
31
+ /**
32
+ * Output file path of the markmap HTML file.
33
+ * If not provided, the same basename as the Markdown input file will be used.
34
+ */
35
+ output?: string;
36
+ }
37
+ export interface IAssetsMap {
38
+ [key: string]: IAssets;
39
+ }
40
+ export interface IFeatures {
41
+ [key: string]: boolean;
42
+ }
43
+ export interface ITransformContext {
44
+ features: IFeatures;
45
+ frontmatter?: any;
46
+ }
47
+ export interface ITransformResult extends ITransformContext {
48
+ root: INode;
49
+ }
50
+ export interface ITransformPlugin {
51
+ name: string;
52
+ transform: (transformHooks: ITransformHooks) => IAssets;
53
+ }