Skip to content

Commit 61d40d5

Browse files
committed
fix: types
1 parent 06daacd commit 61d40d5

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

src/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JSItem } from './types';
1+
import { JSItem, IMarkmapCreateOptions } from './types';
22
import { persistJS, persistPlugins } from './util';
33
import { mathJax, prism } from './plugins';
44

@@ -14,7 +14,7 @@ const baseJs: JSItem[] = [
1414
},
1515
}));
1616

17-
export function fillTemplate(data: any, opts?: any): string {
17+
export function fillTemplate(data: any, opts?: IMarkmapCreateOptions): string {
1818
const { js, css, processors } = persistPlugins([
1919
opts?.mathJax && mathJax,
2020
opts?.prism && prism,

src/types.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,56 @@
11
import { Markmap } from './view';
22

33
export interface IHierachy<T> {
4+
/**
5+
* type
6+
*/
47
t: string;
8+
/**
9+
* payload
10+
*/
511
p?: any;
12+
/**
13+
* children
14+
*/
615
c?: T[];
716
}
817

918
export interface INode extends IHierachy<INode> {
19+
/**
20+
* depth
21+
*/
1022
d?: number;
23+
/**
24+
* value
25+
*/
1126
v: string;
1227
}
1328

1429
export interface IMarkmapCreateOptions {
30+
/**
31+
* whether to open the generated markmap in browser
32+
*/
1533
open?: boolean;
34+
/**
35+
* Markdown content as string. It will be ignored if `input` is provided.
36+
*/
1637
content?: string;
38+
/**
39+
* Input file path of a Markdown file. If this is provided, `content` will be ignored.
40+
*/
1741
input?: string;
42+
/**
43+
* Output file path of the markmap HTML file. If not provided, the same basename as the Markdown input file will be used.
44+
*/
1845
output?: string;
46+
/**
47+
* Enable MathJax support. If an object is passed, it will be merged into MathJax options.
48+
*/
1949
mathJax?: boolean | object;
50+
/**
51+
* Enable Prism support for code blocks.
52+
*/
53+
prism?: boolean;
2054
}
2155

2256
export interface IMarkmapOptions {

0 commit comments

Comments
 (0)