Skip to content

Commit f3536af

Browse files
authored
Merge pull request #59 from takker99:update-scrapbox
feat: Catch up with the latest API of `scrapbox`
2 parents 7cab12b + 32a7987 commit f3536af

30 files changed

+1245
-155
lines changed

blocks.test.ts

Lines changed: 719 additions & 13 deletions
Large diffs are not rendered by default.

blocks.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ export type Line =
3939
/** 画像を並べているときのみ生える */
4040
numberOfImages?: number;
4141

42+
/** 引用文のときのみ生える */
43+
quoteLine?: true;
44+
4245
/** 中に含まれるnodes */
43-
nodes: Node | NodeWithoutIndent[];
46+
get nodes(): Node | NodeWithoutIndent[];
4447
});
4548

4649
/** the type which represents a line in a block */
@@ -62,6 +65,8 @@ export interface CodeBlock extends Block {
6265

6366
/** the file name of the code block */
6467
filename: string;
68+
69+
hasCursor: boolean;
6570
}
6671

6772
/** the type which represents a line in a table block */

node/anchor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Unit } from "./unit.ts";
1+
import type { BracketUnit } from "./unit.ts";
22
import type { PlainText } from "./plainText.ts";
33

44
/** Anchor埋め込み */
@@ -12,7 +12,7 @@ export interface Anchor {
1212
children: PlainText;
1313
}
1414

15-
export interface AnchorUnit extends Unit {
15+
export interface AnchorUnit extends BracketUnit {
1616
/** Anchor video ID */
1717
videoId: string;
1818

node/audio.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { Unit } from "./unit.ts";
1+
import type { BracketUnit } from "./unit.ts";
22
import type { PlainText } from "./plainText.ts";
33

44
/** 音声埋め込み */
55
export interface Audio {
66
type: "audio";
77

88
/** 構文解析結果 */
9-
unit: Unit;
9+
unit: BracketUnit;
1010

1111
/** scrapboxにuploadされたfileのID
1212
*

node/audioLink.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Unit } from "./unit.ts";
1+
import type { BracketUnit } from "./unit.ts";
22
import type { PlainText } from "./plainText.ts";
33

44
/** タイトル付き音声 */
@@ -18,7 +18,7 @@ export interface AudioLink {
1818
children: PlainText;
1919
}
2020

21-
export interface AudioLinkUnit extends Unit {
21+
export interface AudioLinkUnit extends BracketUnit {
2222
/** 音声のURL */
2323
link: string;
2424

node/blank.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { Unit } from "./unit.ts";
1+
import type { BracketUnit } from "./unit.ts";
22
import type { PlainText } from "./plainText.ts";
33

44
/** 空白記法 */
55
export interface Blank {
66
type: "blank";
77

88
/** 構文解析結果 */
9-
unit: Unit;
9+
unit: BracketUnit;
1010

1111
/** the same as `unit.content` */
1212
children: PlainText;

node/code.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ export interface Code {
66
type: "code";
77

88
/** 構文解析結果 */
9-
unit: Unit;
9+
unit: CodeUnit;
1010

1111
/** the same as `unit.content` */
1212
children: PlainText;
1313
}
14+
15+
export interface CodeUnit extends Unit {
16+
content: string;
17+
whole: `\`${string}\``;
18+
}

node/decoration.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Unit } from "./unit.ts";
1+
import type { BracketUnit } from "./unit.ts";
22
import type { PlainText } from "./plainText.ts";
33
import type { Formula } from "./formula.ts";
44
import type { Link } from "./link.ts";
@@ -52,7 +52,7 @@ export interface Decoration {
5252
children: NodeInDecoration | NodeInDecoration[];
5353
}
5454

55-
export interface DecorationUnit extends Unit {
55+
export interface DecorationUnit extends BracketUnit {
5656
/** 文字装飾記号 */
5757
deco: string;
5858

@@ -72,4 +72,6 @@ export interface DecorationUnit extends Unit {
7272

7373
/** 下線記号`_`を含むとき`true` */
7474
underline: boolean;
75+
76+
whole: `[${string} ${string}]`;
7577
}

node/formula.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { Unit } from "./unit.ts";
2-
import type { PlainText } from "./plainText.ts";
1+
import type { BracketUnit } from "./unit.ts";
32

43
/** 数式記法 */
54
export interface Formula {
@@ -9,13 +8,17 @@ export interface Formula {
98
unit: FormulaUnit;
109

1110
/** the same as `unit.content` */
12-
children: PlainText;
11+
children: `$ ${string}`;
1312
}
1413

15-
export interface FormulaUnit extends Unit {
14+
export interface FormulaUnit extends BracketUnit {
1615
/** KaTeX text
1716
*
1817
* `content` から`$ `を外したもの
1918
*/
2019
formula: string;
20+
21+
content: `$ ${string}`;
22+
23+
whole: `[$ ${string}]`;
2124
}

node/googleMap.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Unit } from "./unit.ts";
1+
import type { BracketUnit } from "./unit.ts";
22
import type { PlainText } from "./plainText.ts";
33

44
/** Location記法 */
@@ -12,7 +12,9 @@ export interface GoogleMap {
1212
children: PlainText;
1313
}
1414

15-
export interface GoogleMapUnit extends Unit {
15+
declare const unit: GoogleMapUnit;
16+
17+
export interface GoogleMapUnit extends BracketUnit {
1618
/** 緯度 */
1719
latitude: number;
1820

@@ -24,4 +26,13 @@ export interface GoogleMapUnit extends Unit {
2426

2527
/** 地点の名前 */
2628
title?: string;
29+
content:
30+
| `${"N" | "S"}${number},${"E" | "W"}${number}${`,Z${number}` | ""}`
31+
| `${"N" | "S"}${number},${"E" | "W"}${number}${
32+
| `,Z${number}`
33+
| ""} ${string}`
34+
| `${string} ${"N" | "S"}${number},${"E" | "W"}${number}${
35+
| `,Z${number}`
36+
| ""}`;
37+
whole: `[${this["content"]}]`;
2738
}

0 commit comments

Comments
 (0)