-
Notifications
You must be signed in to change notification settings - Fork 2
/
blocks.ts
90 lines (73 loc) · 1.82 KB
/
blocks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import type { Node, NodeWithoutIndent } from "./node/node.ts";
import type { BaseLine } from "./base.ts";
export type Line =
& BaseLine
& {
section: {
/** section number */
number: number;
/** section開始行なら`true` */
start: boolean;
/** section終了行なら`true` */
end: boolean;
};
}
& ({
/** タイトル行だったときのみ生える */
title?: true;
} | {
codeBlock: CodeBlock;
} | {
tableBlock: TableBlock;
} | {
helpfeel: Helpfeel;
} | {
cli: Cli;
} | {
/** 番号付きリストのときのみ生える */
numberList?: {
/** 番号の長さ */
digit: number;
};
/** 数式を含む行のときのみ生える */
formulaLine?: true;
/** 画像を並べているときのみ生える */
numberOfImages?: number;
/** 中に含まれるnodes */
nodes: Node | NodeWithoutIndent[];
});
/** the type which represents a line in a block */
export interface Block {
/** the number of indents */
indent: number;
/** is the start line of this block */
start: boolean;
/** is the end line of this block */
end: boolean;
}
/** the type which represents a line in a code block */
export interface CodeBlock extends Block {
/** the language of the code block */
lang: string;
/** the file name of the code block */
filename: string;
}
/** the type which represents a line in a table block */
export interface TableBlock extends Block {
/** the title of the table block */
title: string;
/** cells included in the present line */
cells: string[];
}
/** Helpfeel記法 */
export interface Helpfeel {
prefix: "?";
/** Helpfeel本文 */
entry: string;
}
/** Command Line記法 */
export interface Cli {
prefix: "$" | "%";
/** Command Line本文 */
command: string;
}