Skip to content

Commit 865ed07

Browse files
committed
🐛 scrapbox.Page.linesの型定義を2023-01-06時点のにあわせた
1 parent e42e475 commit 865ed07

File tree

7 files changed

+79
-9
lines changed

7 files changed

+79
-9
lines changed

blocks.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ export type Line =
3232
/** 番号の長さ */
3333
digit: number;
3434
};
35+
3536
/** 数式を含む行のときのみ生える */
3637
formulaLine?: true;
38+
39+
/** 画像を並べているときのみ生える */
40+
numberOfImages?: number;
41+
3742
/** 中に含まれるnodes */
3843
nodes: Node | NodeWithoutIndent[];
3944
});

node/anchor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { PlainText } from "./plainText.ts";
33

44
/** Anchor埋め込み */
55
export interface Anchor {
6-
type: "anchor";
6+
type: "anchor-fm";
77

88
/** 構文解析結果 */
99
unit: AnchorUnit;

node/decoration.ts

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
import { Unit } from "./unit.ts";
2-
import { NodeWithoutIndent } from "./node.ts";
2+
import { PlainText } from "./plainText.ts";
3+
import { Formula } from "./formula.ts";
4+
import { Link } from "./link.ts";
5+
import { HashTag } from "./hashTag.ts";
6+
import { Icon } from "./icon.ts";
7+
import { UrlLink } from "./urlLink.ts";
8+
import { Url } from "./url.ts";
9+
import { Image } from "./image.ts";
10+
import { Gyazo } from "./gyazo.ts";
11+
import { ImageLink } from "./imageLink.ts";
12+
import { GyazoLink } from "./gyazoLink.ts";
13+
import { Video } from "./video.ts";
14+
import { Youtube } from "./youtube.ts";
15+
import { Vimeo } from "./vimeo.ts";
16+
import { Audio } from "./audio.ts";
17+
import { AudioLink } from "./audioLink.ts";
18+
import { Spotify } from "./spotify.ts";
19+
import { Anchor } from "./anchor.ts";
20+
import { GoogleMap } from "./googleMap.ts";
21+
22+
/** 文字装飾記法中に入れられる記法 */
23+
export type NodeInDecoration =
24+
| PlainText
25+
| Formula
26+
| Link
27+
| HashTag
28+
| Icon
29+
| UrlLink
30+
| Url
31+
| Image
32+
| Gyazo
33+
| ImageLink
34+
| GyazoLink
35+
| Video
36+
| Audio
37+
| AudioLink
38+
| Spotify
39+
| Anchor
40+
| Youtube
41+
| Vimeo
42+
| GoogleMap;
343

444
/** 文字装飾記法 */
545
export interface Decoration {
@@ -9,7 +49,7 @@ export interface Decoration {
949
unit: DecorationUnit;
1050

1151
/** 中に含まれるNode */
12-
children: NodeWithoutIndent;
52+
children: NodeInDecoration | NodeInDecoration[];
1353
}
1454

1555
export interface DecorationUnit extends Unit {

node/hashTag.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { NodeWithoutIndent } from "./node.ts";
2+
3+
/** hashtag */
4+
export interface HashTag {
5+
type: "hashTag";
6+
7+
/** 構文解析結果 */
8+
unit: HashTagUnit;
9+
10+
/** 中に含まれるNodes */
11+
children: NodeWithoutIndent | NodeWithoutIndent[];
12+
}
13+
14+
export interface HashTagUnit {
15+
/** page title */
16+
page: string;
17+
18+
tag: "#";
19+
}

node/icon.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Unit } from "./unit.ts";
21
import { PlainText } from "./plainText.ts";
32

43
/** アイコン記法 */
@@ -23,7 +22,7 @@ export interface StrongIcon {
2322
children: PlainText;
2423
}
2524

26-
export interface IconUnit extends Unit {
25+
export interface IconUnit {
2726
/** アイコンがあるproject name
2827
*
2928
* 同じprojectのアイコンのときは省略される

node/link.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Unit } from "./unit.ts";
21
import { PlainText } from "./plainText.ts";
32

43
/** リンク記法
@@ -20,20 +19,26 @@ export interface Link {
2019
children: PlainText;
2120
}
2221

23-
export interface InternalLinkUnit extends Unit {
22+
export interface InternalLinkUnit {
2423
/** page title */
2524
page: string;
25+
26+
/** line id */
27+
line?: string;
2628
}
2729

28-
export interface ProjectLinkUnit extends Unit {
30+
export interface ProjectLinkUnit {
2931
/** project name */
3032
project: string;
3133

3234
/** page title */
3335
page: string;
36+
37+
/** line id */
38+
line?: string;
3439
}
3540

36-
export interface ProjectHomeLinkUnit extends Unit {
41+
export interface ProjectHomeLinkUnit {
3742
/** project name */
3843
project: string;
3944
}

node/node.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Decoration } from "./decoration.ts";
66
import { Quote } from "./quote.ts";
77
import { Strong } from "./strong.ts";
88
import { Link } from "./link.ts";
9+
import { HashTag } from "./hashTag.ts";
910
import { Icon, StrongIcon } from "./icon.ts";
1011
import { UrlLink } from "./urlLink.ts";
1112
import { Url } from "./url.ts";
@@ -32,6 +33,7 @@ export type NodeWithoutIndent =
3233
| Quote
3334
| Strong
3435
| Link
36+
| HashTag
3537
| Icon
3638
| StrongIcon
3739
| UrlLink

0 commit comments

Comments
 (0)