document-ir 0.2.0 → 0.3.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.
@@ -1,4 +1,4 @@
1
- import { ArrayNode, BlockNode, BlockQuoteNode, BoldNode, BreakNode, BubbleNode, CardNode, CenterNode, CodeNode, ColumnsNode, DateNode, DateTimeNode, DefinitionListNode, DefinitionNode, DefinitionReferenceNode, DocumentNode, EmbedNode, EmojiNode, FigureCaptionNode, FigureImageNode, FigureNode, FormattedTextNode, HeaderNode, HighTechAlertNode, HorizontalRuleNode, ImageNode, ItalicNode, LinkNode, ListNode, Node, NoteNode, TimeRangeNode, ParagraphNode, QuoteNode, RedactedNode, RegionNode, ScriptNode, SecretNode, SmallerNode, SocialNode, StandardNode, StickerNode, StrikeThroughNode, SubTextNode, SuperTextNode, TableNode, TableOfContentsNode, TextNode, TimeNode, UnderlineNode, VideoNode, WarningNode } from './types.ts';
1
+ import { AccordionGroupNode, AccordionTabNode, ArrayNode, BlockNode, BlockQuoteNode, BoldNode, BreakNode, BubbleNode, CardNode, CenterNode, CodeNode, CodeBlockNode, CodeGroupNode, CodeGroupTabNode, ColumnsNode, DateNode, DateTimeNode, DefinitionListNode, DefinitionNode, DefinitionReferenceNode, DocumentNode, EmbedNode, EmojiNode, FigureCaptionNode, FigureImageNode, FigureNode, FormattedTextNode, HeaderNode, HighTechAlertNode, HorizontalRuleNode, ImageNode, ItalicNode, LinkNode, ListNode, Node, NoteNode, PillNode, TimeRangeNode, ParagraphNode, QuoteNode, RedactedNode, RegionNode, ScriptNode, SecretNode, StyleNode, SmallerNode, SocialNode, StandardNode, StickerNode, StrikeThroughNode, SubTextNode, SuperTextNode, TableNode, TableOfContentsNode, TextNode, TimeNode, UnderlineNode, VideoNode, WarningNode } from './types.ts';
2
2
  export declare class IdentityTransformer {
3
3
  protected beforeBlock(): Promise<void>;
4
4
  protected afterBlock(): Promise<void>;
@@ -12,6 +12,11 @@ export declare class IdentityTransformer {
12
12
  protected bubble(node: BubbleNode): Promise<Node | null>;
13
13
  protected center(node: CenterNode): Promise<Node | null>;
14
14
  protected code(node: CodeNode): Promise<Node | null>;
15
+ protected codeBlock(node: CodeBlockNode): Promise<Node | null>;
16
+ protected accordionTab(node: AccordionTabNode): Promise<AccordionTabNode>;
17
+ protected accordionGroup(node: AccordionGroupNode): Promise<Node | null>;
18
+ protected codeGroupTab(node: CodeGroupTabNode): Promise<CodeGroupTabNode>;
19
+ protected codeGroup(node: CodeGroupNode): Promise<Node | null>;
15
20
  protected columns(node: ColumnsNode): Promise<Node | null>;
16
21
  protected definition(node: DefinitionNode): Promise<DefinitionNode | null>;
17
22
  protected definitionList(node: DefinitionListNode): Promise<Node | null>;
@@ -32,10 +37,12 @@ export declare class IdentityTransformer {
32
37
  protected note(node: NoteNode): Promise<Node | null>;
33
38
  protected list(node: ListNode): Promise<Node | null>;
34
39
  protected paragraph(node: ParagraphNode): Promise<Node | null>;
40
+ protected pill(node: PillNode): Promise<Node | null>;
35
41
  protected quote(node: QuoteNode): Promise<Node | null>;
36
42
  protected redacted(node: RedactedNode): Promise<Node | null>;
37
43
  protected region(node: RegionNode): Promise<Node | null>;
38
44
  protected script(node: ScriptNode): Promise<Node | null>;
45
+ protected style(node: StyleNode): Promise<Node | null>;
39
46
  protected secret(node: SecretNode): Promise<Node | null>;
40
47
  protected smaller(node: SmallerNode): Promise<Node | null>;
41
48
  protected sticker(node: StickerNode): Promise<Node | null>;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- var b = Object.defineProperty;
2
- var y = (c, t, e) => t in c ? b(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
1
+ var d = Object.defineProperty;
2
+ var y = (c, t, e) => t in c ? d(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
3
  var l = (c, t, e) => y(c, typeof t != "symbol" ? t + "" : t, e);
4
4
  class u {
5
5
  async beforeBlock() {
@@ -84,6 +84,58 @@ class u {
84
84
  type: "code",
85
85
  content: e
86
86
  };
87
+ return t.diff != null && (i.diff = t.diff), t.lineNumbers != null && (i.lineNumbers = t.lineNumbers), t.id != null && (i.id = t.id), i;
88
+ }
89
+ async codeBlock(t) {
90
+ const i = {
91
+ type: "code-block",
92
+ content: await this.code(t.content),
93
+ fileName: t.fileName
94
+ };
95
+ return t.copyable != null && (i.copyable = t.copyable), t.collapsable != null && (i.collapsable = t.collapsable), t.collapsed != null && (i.collapsed = t.collapsed), t.id != null && (i.id = t.id), i;
96
+ }
97
+ async accordionTab(t) {
98
+ await this.beforeInline();
99
+ const e = await this.chooseChildren(t.header);
100
+ await this.afterInline(), await this.beforeBlock();
101
+ const i = await this.chooseChildren(t.content);
102
+ await this.afterBlock();
103
+ const r = {
104
+ type: "accordion-tab",
105
+ header: e,
106
+ content: i
107
+ };
108
+ return t.open != null && (r.open = t.open), t.id != null && (r.id = t.id), r;
109
+ }
110
+ async accordionGroup(t) {
111
+ const e = [];
112
+ for (const r of t.tabs)
113
+ e.push(await this.accordionTab(r));
114
+ const i = {
115
+ type: "accordion-group",
116
+ tabs: e
117
+ };
118
+ return t.id != null && (i.id = t.id), i;
119
+ }
120
+ async codeGroupTab(t) {
121
+ await this.beforeInline();
122
+ const e = await this.chooseChildren(t.header);
123
+ await this.afterInline();
124
+ const i = await this.code(t.content), r = {
125
+ type: "code-group-tab",
126
+ header: e,
127
+ content: i
128
+ };
129
+ return t.copyable != null && (r.copyable = t.copyable), t.id != null && (r.id = t.id), r;
130
+ }
131
+ async codeGroup(t) {
132
+ const e = [];
133
+ for (const r of t.tabs)
134
+ e.push(await this.codeGroupTab(r));
135
+ const i = {
136
+ type: "code-group",
137
+ tabs: e
138
+ };
87
139
  return t.id != null && (i.id = t.id), i;
88
140
  }
89
141
  async columns(t) {
@@ -286,11 +338,11 @@ class u {
286
338
  await this.beforeBlock();
287
339
  const s = await this.chooseChildren(r.content);
288
340
  if (await this.afterBlock(), s && s.length > 0) {
289
- const a = {
341
+ const n = {
290
342
  type: "list-item",
291
343
  content: s
292
344
  };
293
- r.id != null && (a.id = r.id), e.push(a);
345
+ r.id != null && (n.id = r.id), e.push(n);
294
346
  }
295
347
  }
296
348
  const i = {
@@ -310,6 +362,17 @@ class u {
310
362
  };
311
363
  return t.id != null && (i.id = t.id), i;
312
364
  }
365
+ async pill(t) {
366
+ await this.beforeInline();
367
+ const e = await this.chooseChildren(t.content);
368
+ await this.afterInline();
369
+ const i = {
370
+ type: "pill",
371
+ color: t.color,
372
+ content: e
373
+ };
374
+ return t.id != null && (i.id = t.id), i;
375
+ }
313
376
  async quote(t) {
314
377
  await this.beforeBlock();
315
378
  const e = await this.chooseChildren(t.content);
@@ -352,7 +415,13 @@ class u {
352
415
  "mime-type": t["mime-type"] || "text/javascript",
353
416
  source: t.source
354
417
  };
355
- return t.id != null && (e.id = t.id), e;
418
+ return t.url && (e.url = t.url), t.id != null && (e.id = t.id), e;
419
+ }
420
+ async style(t) {
421
+ const e = {
422
+ type: "style"
423
+ };
424
+ return t.source && (e.source = t.source), t.url && (e.url = t.url), t.id != null && (e.id = t.id), e;
356
425
  }
357
426
  async secret(t) {
358
427
  await this.beforeInline();
@@ -421,19 +490,19 @@ class u {
421
490
  const e = [];
422
491
  for (const r of t.content) {
423
492
  const s = [];
424
- let a = 0;
425
- for (const n of r) {
493
+ let n = 0;
494
+ for (const a of r) {
426
495
  await this.beforeBlock();
427
- const o = await this.chooseChildren(n.content);
428
- await this.afterBlock(), o && o.length == 0 && a++;
496
+ const o = await this.chooseChildren(a.content);
497
+ await this.afterBlock(), o && o.length == 0 && n++;
429
498
  const h = {
430
499
  type: "table-cell",
431
- span: [n.span[0] || 1, n.span[1] || 1],
500
+ span: [a.span[0] || 1, a.span[1] || 1],
432
501
  content: o
433
502
  };
434
- n.id != null && (h.id = n.id), n.header && (h.header = n.header), s.push(h);
503
+ a.id != null && (h.id = a.id), a.header && (h.header = a.header), s.push(h);
435
504
  }
436
- s.length > 0 && a != s.length && e.push(s);
505
+ s.length > 0 && n != s.length && e.push(s);
437
506
  }
438
507
  const i = {
439
508
  type: "table",
@@ -483,10 +552,10 @@ class u {
483
552
  let e;
484
553
  if (t.content) {
485
554
  await this.beforeBlock();
486
- const n = await this.chooseChildren(t.content.content);
487
- n && n.length > 0 && (e = {
555
+ const a = await this.chooseChildren(t.content.content);
556
+ a && a.length > 0 && (e = {
488
557
  type: "card-content",
489
- content: n
558
+ content: a
490
559
  }, t.content.id != null && (e.id = t.content.id)), await this.afterBlock();
491
560
  }
492
561
  let i;
@@ -494,16 +563,16 @@ class u {
494
563
  type: "card-attribution"
495
564
  }, t.attribution.id != null && (i.id = t.attribution.id), t.attribution.archiveUrl && (i.archiveUrl = t.attribution.archiveUrl), t.attribution.url && (i.url = t.attribution.url), t.attribution.date && (i.date = t.attribution.date), t.attribution.title)) {
496
565
  await this.beforeBlock();
497
- const n = await this.chooseChildren(t.attribution.title);
498
- await this.afterBlock(), i.title = n;
566
+ const a = await this.chooseChildren(t.attribution.title);
567
+ await this.afterBlock(), i.title = a;
499
568
  }
500
569
  let r;
501
570
  if (t.header) {
502
571
  await this.beforeBlock();
503
- const n = await this.chooseChildren(t.header.title);
572
+ const a = await this.chooseChildren(t.header.title);
504
573
  await this.afterBlock(), r = {
505
574
  type: "card-header",
506
- title: n,
575
+ title: a,
507
576
  backgroundBlurhash: t.header.backgroundBlurhash,
508
577
  backgroundColor: t.header.backgroundColor,
509
578
  backgroundImage: t.header.backgroundImage,
@@ -513,18 +582,18 @@ class u {
513
582
  }
514
583
  let s;
515
584
  if (t.media) {
516
- const n = [];
585
+ const a = [];
517
586
  for (const o of t.media.content) {
518
587
  await this.beforeBlock();
519
588
  const h = await this.choose(o);
520
- h && (h.type == "image" || h.type == "video" || h.type == "embed") && n.push(h), await this.afterBlock();
589
+ h && (h.type == "image" || h.type == "video" || h.type == "embed") && a.push(h), await this.afterBlock();
521
590
  }
522
- n.length > 0 && (s = {
591
+ a.length > 0 && (s = {
523
592
  type: "card-media",
524
- content: n
593
+ content: a
525
594
  }, t.media.id != null && (s.id = t.media.id));
526
595
  }
527
- const a = {
596
+ const n = {
528
597
  type: "card",
529
598
  content: e,
530
599
  attribution: i,
@@ -532,7 +601,7 @@ class u {
532
601
  media: s,
533
602
  original: t.original
534
603
  };
535
- return t.id != null && (a.id = t.id), a;
604
+ return t.id != null && (n.id = t.id), n;
536
605
  }
537
606
  async date(t) {
538
607
  await this.beforeInline();
@@ -594,13 +663,13 @@ class u {
594
663
  const r = await this.chooseChildren(t.children);
595
664
  await this.afterBlock();
596
665
  const s = r.filter(
597
- (n) => n.type == "toc"
598
- ), a = {
666
+ (a) => a.type == "toc"
667
+ ), n = {
599
668
  type: "toc",
600
669
  content: e,
601
670
  children: s
602
671
  };
603
- return t.id != null && (a.id = t.id), i && (i.type == "date" || i.type == "time" || i.type == "datetime") && (a.date = i), t.href && (a.href = t.href), t.hrefHtmlId && (a.hrefHtmlId = t.hrefHtmlId), a;
672
+ return t.id != null && (n.id = t.id), i && (i.type == "date" || i.type == "time" || i.type == "datetime") && (n.date = i), t.href && (n.href = t.href), t.hrefHtmlId && (n.hrefHtmlId = t.hrefHtmlId), n;
604
673
  }
605
674
  async timeRange(t) {
606
675
  await this.beforeBlock();
@@ -633,6 +702,10 @@ class u {
633
702
  return await this.center(t);
634
703
  case "code":
635
704
  return await this.code(t);
705
+ case "code-block":
706
+ return await this.codeBlock(t);
707
+ case "code-group":
708
+ return await this.codeGroup(t);
636
709
  case "columns":
637
710
  return await this.columns(t);
638
711
  case "definition":
@@ -665,6 +738,8 @@ class u {
665
738
  return await this.italic(t);
666
739
  case "link":
667
740
  return await this.link(t);
741
+ case "accordion-group":
742
+ return await this.accordionGroup(t);
668
743
  case "array":
669
744
  return await this.array(t);
670
745
  case "note":
@@ -673,6 +748,8 @@ class u {
673
748
  return await this.list(t);
674
749
  case "paragraph":
675
750
  return await this.paragraph(t);
751
+ case "pill":
752
+ return await this.pill(t);
676
753
  case "quote":
677
754
  return await this.quote(t);
678
755
  case "redacted":
@@ -683,6 +760,8 @@ class u {
683
760
  return await this.script(t);
684
761
  case "secret":
685
762
  return await this.secret(t);
763
+ case "style":
764
+ return await this.style(t);
686
765
  case "smaller":
687
766
  return await this.smaller(t);
688
767
  case "sticker":
@@ -733,7 +812,7 @@ class u {
733
812
  const e = await this.chooseChildren(t.content);
734
813
  await this.afterBlock(), await this.beforeBlock();
735
814
  const i = t.definitions && (await this.chooseChildren(t.definitions)).filter(
736
- (a) => a.type == "definition"
815
+ (n) => n.type == "definition"
737
816
  ), r = t.hierarchy;
738
817
  await this.afterBlock();
739
818
  const s = {
@@ -742,7 +821,7 @@ class u {
742
821
  content: e,
743
822
  url: t.url
744
823
  };
745
- return t.image && (s.image = t.image), t.guid && (s.guid = t.guid), t["pub-date"] && (s["pub-date"] = t["pub-date"]), t.description && (s.description = t.description), t.date && (s.date = t.date), r && (s.hierarchy = r), i && (s.definitions = i), t.noindex && (s.noindex = t.noindex), t.author && (s.author = t.author), t.hidden && (s.hidden = t.hidden), t.readingDifficultyMultiplier && (s.readingDifficultyMultiplier = t.readingDifficultyMultiplier), t.contentDigest && (s.contentDigest = t.contentDigest), s;
824
+ return t.image && (s.image = t.image), t.guid && (s.guid = t.guid), t["pub-date"] && (s["pub-date"] = t["pub-date"]), t.description && (s.description = t.description), t.date && (s.date = t.date), r && (s.hierarchy = r), i && (s.definitions = i), t.noindex && (s.noindex = t.noindex), t.author && (s.author = t.author), t.hidden && (s.hidden = t.hidden), t.readingDifficultyMultiplier && (s.readingDifficultyMultiplier = t.readingDifficultyMultiplier), t.contentDigest && (s.contentDigest = t.contentDigest), t.keywords && (s.keywords = t.keywords), s;
746
825
  }
747
826
  async transform(t) {
748
827
  return await this.document(t);
@@ -764,19 +843,19 @@ class I extends u {
764
843
  async chooseChildren(t) {
765
844
  const e = await super.chooseChildren(t), i = [];
766
845
  let r = null, s;
767
- for (const a of e)
768
- if (a.type == "text")
769
- r != null ? r = `${r}${a.text}` : (r = a.text, s = a.id);
846
+ for (const n of e)
847
+ if (n.type == "text")
848
+ r != null ? r = `${r}${n.text}` : (r = n.text, s = n.id);
770
849
  else {
771
850
  if (r != null) {
772
- const n = { type: "text", text: r };
773
- s != null && (n.id = s), i.push(n), r = null, s = void 0;
851
+ const a = { type: "text", text: r };
852
+ s != null && (a.id = s), i.push(a), r = null, s = void 0;
774
853
  }
775
- i.push(a);
854
+ i.push(n);
776
855
  }
777
856
  if (r != null) {
778
- const a = { type: "text", text: r };
779
- s != null && (a.id = s), i.push(a);
857
+ const n = { type: "text", text: r };
858
+ s != null && (n.id = s), i.push(n);
780
859
  }
781
860
  return i;
782
861
  }
@@ -854,23 +933,23 @@ class v extends u {
854
933
  this.cursor.parent && (this.cursor = this.cursor.parent);
855
934
  }
856
935
  reviewBlock(e) {
857
- const i = [], r = (s, a) => {
936
+ const i = [], r = (s, n) => {
858
937
  if (s.type == "text")
859
938
  i.push({
860
939
  node: s,
861
- level: a
940
+ level: n
862
941
  });
863
942
  else if (s.type == "_block")
864
- this.reviewBlock(s), i.push({ node: null, level: a });
943
+ this.reviewBlock(s), i.push({ node: null, level: n });
865
944
  else
866
- for (const n of s.content)
867
- r(n, a + 1);
945
+ for (const a of s.content)
946
+ r(a, n + 1);
868
947
  };
869
948
  for (const s of e.content)
870
949
  r(s, 0);
871
950
  for (let s = 0; s < i.length; s++) {
872
- const a = i[s], n = s + 1 < i.length ? i[s + 1] : { node: null, level: 0 };
873
- !a.node || !n.node || a.level != n.level && (a.level < n.level ? n.node.text.startsWith(" ") && (n.node.text = n.node.text.slice(1), a.node.text += " ") : a.level > n.level && a.node.text.endsWith(" ") && (a.node.text = a.node.text.slice(0, -1), n.node.text = ` ${n.node.text}`));
951
+ const n = i[s], a = s + 1 < i.length ? i[s + 1] : { node: null, level: 0 };
952
+ !n.node || !a.node || n.level != a.level && (n.level < a.level ? a.node.text.startsWith(" ") && (a.node.text = a.node.text.slice(1), n.node.text += " ") : n.level > a.level && n.node.text.endsWith(" ") && (n.node.text = n.node.text.slice(0, -1), a.node.text = ` ${a.node.text}`));
874
953
  }
875
954
  }
876
955
  async text(e) {
@@ -1317,27 +1396,27 @@ class B extends k {
1317
1396
  for (const i of t.content) {
1318
1397
  const r = [], s = await this.chooseChildren(i.title);
1319
1398
  if (s)
1320
- for (const n of s)
1321
- r.push(n);
1399
+ for (const a of s)
1400
+ r.push(a);
1322
1401
  r.push({ type: "text", text: " " });
1323
- const a = await this.chooseChildren(i.abbreviation);
1324
- if (a)
1325
- for (const n of a)
1326
- r.push(n);
1402
+ const n = await this.chooseChildren(i.abbreviation);
1403
+ if (n)
1404
+ for (const a of n)
1405
+ r.push(a);
1327
1406
  if (i.content.length > 0 && i.content[0].type != "paragraph") {
1328
1407
  r.push({ type: "text", text: " " });
1329
- const n = await this.chooseChildren(i.content);
1330
- if (n)
1331
- for (const o of n)
1408
+ const a = await this.chooseChildren(i.content);
1409
+ if (a)
1410
+ for (const o of a)
1332
1411
  r.push(o);
1333
1412
  }
1334
1413
  if (e.push({
1335
1414
  type: "paragraph",
1336
1415
  content: r
1337
1416
  }), i.content.length > 0 && i.content[0].type == "paragraph") {
1338
- const n = await this.chooseChildren(i.content);
1339
- if (n)
1340
- for (const o of n)
1417
+ const a = await this.chooseChildren(i.content);
1418
+ if (a)
1419
+ for (const o of a)
1341
1420
  e.push(o);
1342
1421
  }
1343
1422
  }
@@ -1398,7 +1477,7 @@ class B extends k {
1398
1477
  };
1399
1478
  }
1400
1479
  }
1401
- class x extends w {
1480
+ class C extends w {
1402
1481
  constructor() {
1403
1482
  super();
1404
1483
  l(this, "count");
@@ -1424,24 +1503,24 @@ class x extends w {
1424
1503
  return this.countText(), this.count;
1425
1504
  }
1426
1505
  }
1427
- function d(c) {
1506
+ function b(c) {
1428
1507
  const t = {
1429
1508
  headerText: c.header,
1430
1509
  headerId: c.headerId,
1431
1510
  words: 0,
1432
1511
  totalWords: 0,
1433
1512
  children: []
1434
- }, e = new x();
1513
+ }, e = new C();
1435
1514
  for (const i of c.nodes)
1436
1515
  e.visit(i);
1437
1516
  t.words = e.getCount(), t.totalWords = t.words;
1438
1517
  for (const i of c.children) {
1439
- const r = d(i);
1518
+ const r = b(i);
1440
1519
  t.children.push(r), t.totalWords += r.totalWords;
1441
1520
  }
1442
1521
  return t;
1443
1522
  }
1444
- class L extends u {
1523
+ class N extends u {
1445
1524
  constructor() {
1446
1525
  super();
1447
1526
  }
@@ -1454,12 +1533,12 @@ class L extends u {
1454
1533
  depth: 1
1455
1534
  };
1456
1535
  r.push(s);
1457
- let a = 1;
1536
+ let n = 1;
1458
1537
  for (const o of i.content)
1459
1538
  if (o.type == "header") {
1460
1539
  if (o.level == 1)
1461
1540
  continue;
1462
- if (o.level <= a)
1541
+ if (o.level <= n)
1463
1542
  for (let p = r.length - 1; p > 0; p--)
1464
1543
  r[p].depth >= o.level && r.pop();
1465
1544
  const h = new g();
@@ -1470,13 +1549,13 @@ class L extends u {
1470
1549
  children: [],
1471
1550
  nodes: []
1472
1551
  };
1473
- o.htmlId && (f.headerId = o.htmlId), r[r.length - 1].children.push(f), r.push(f), a = o.level;
1552
+ o.htmlId && (f.headerId = o.htmlId), r[r.length - 1].children.push(f), r.push(f), n = o.level;
1474
1553
  } else
1475
1554
  r[r.length - 1].nodes.push(o);
1476
- const n = {
1555
+ const a = {
1477
1556
  ...t
1478
1557
  };
1479
- return n.hierarchy = d(s), n;
1558
+ return a.hierarchy = b(s), a;
1480
1559
  }
1481
1560
  }
1482
1561
  export {
@@ -1488,6 +1567,6 @@ export {
1488
1567
  g as TextVisitor,
1489
1568
  v as WhitespaceStretchingTransformer,
1490
1569
  T as WhitespaceTransformer,
1491
- L as WordCounterTransformer,
1492
- x as WordCounterVisitor
1570
+ N as WordCounterTransformer,
1571
+ C as WordCounterVisitor
1493
1572
  };
package/dist/types.d.ts CHANGED
@@ -32,6 +32,36 @@ export interface CenterNode extends NodeIdentity {
32
32
  export interface CodeNode extends NodeIdentity {
33
33
  type: "code";
34
34
  content: Node[];
35
+ diff?: boolean;
36
+ lineNumbers?: boolean;
37
+ }
38
+ export interface CodeBlockNode extends NodeIdentity {
39
+ type: "code-block";
40
+ content: CodeNode;
41
+ fileName: string;
42
+ copyable?: boolean;
43
+ collapsable?: boolean;
44
+ collapsed?: boolean;
45
+ }
46
+ export interface CodeGroupTabNode extends NodeIdentity {
47
+ type: "code-group-tab";
48
+ header: Node[];
49
+ content: CodeNode;
50
+ copyable?: boolean;
51
+ }
52
+ export interface CodeGroupNode extends NodeIdentity {
53
+ type: "code-group";
54
+ tabs: CodeGroupTabNode[];
55
+ }
56
+ export interface AccordionTabNode extends NodeIdentity {
57
+ type: "accordion-tab";
58
+ header: Node[];
59
+ content: Node[];
60
+ open?: boolean;
61
+ }
62
+ export interface AccordionGroupNode extends NodeIdentity {
63
+ type: "accordion-group";
64
+ tabs: AccordionTabNode[];
35
65
  }
36
66
  export interface ColumnsNode extends NodeIdentity {
37
67
  type: "columns";
@@ -180,6 +210,18 @@ export interface ScriptNode extends NodeIdentity {
180
210
  type: "script";
181
211
  "mime-type": string;
182
212
  source: string;
213
+ url?: string;
214
+ }
215
+ export interface StyleNode extends NodeIdentity {
216
+ type: "style";
217
+ source?: string;
218
+ url?: string;
219
+ }
220
+ export type PillColor = "neutral" | "blue" | "green" | "red" | "yellow" | "purple" | "gray" | "teal" | "orange";
221
+ export interface PillNode extends NodeIdentity {
222
+ type: "pill";
223
+ color: PillColor;
224
+ content: Node[];
183
225
  }
184
226
  export interface SecretNode extends NodeIdentity {
185
227
  type: "secret";
@@ -337,7 +379,7 @@ export interface TableOfContentsNode extends NodeIdentity {
337
379
  content: Node[];
338
380
  children: TableOfContentsNode[];
339
381
  }
340
- export type Node = ArrayNode | BlockNode | BlockQuoteNode | BoldNode | BreakNode | BubbleNode | CardNode | CenterNode | CodeNode | ColumnsNode | DefinitionNode | DefinitionListNode | DefinitionReferenceNode | EmbedNode | EmojiNode | FigureNode | FigureCaptionNode | FigureImageNode | FormattedTextNode | HeaderNode | HighTechAlertNode | HorizontalRuleNode | ImageNode | ItalicNode | LinkNode | ListNode | NoteNode | ParagraphNode | QuoteNode | RedactedNode | RegionNode | ScriptNode | SecretNode | SmallerNode | StickerNode | StrikeThroughNode | TextNode | TableNode | SocialNode | UnderlineNode | VideoNode | DateNode | TimeNode | DateTimeNode | SuperTextNode | SubTextNode | TableOfContentsNode | TimeRangeNode | StandardNode | WarningNode;
382
+ export type Node = AccordionGroupNode | ArrayNode | BlockNode | BlockQuoteNode | BoldNode | BreakNode | BubbleNode | CardNode | CenterNode | CodeNode | CodeBlockNode | CodeGroupNode | ColumnsNode | DefinitionNode | DefinitionListNode | DefinitionReferenceNode | EmbedNode | EmojiNode | FigureNode | FigureCaptionNode | FigureImageNode | FormattedTextNode | HeaderNode | HighTechAlertNode | HorizontalRuleNode | ImageNode | ItalicNode | LinkNode | ListNode | NoteNode | ParagraphNode | PillNode | QuoteNode | RedactedNode | RegionNode | ScriptNode | SecretNode | StyleNode | SmallerNode | StickerNode | StrikeThroughNode | TextNode | TableNode | SocialNode | UnderlineNode | VideoNode | DateNode | TimeNode | DateTimeNode | SuperTextNode | SubTextNode | TableOfContentsNode | TimeRangeNode | StandardNode | WarningNode;
341
383
  export interface DocumentMeta {
342
384
  hidden?: boolean;
343
385
  noindex?: boolean;
@@ -351,6 +393,7 @@ export interface DocumentMeta {
351
393
  url: string;
352
394
  contentDigest?: string;
353
395
  readingDifficultyMultiplier?: number;
396
+ keywords?: string[];
354
397
  }
355
398
  export interface DocumentHierarchy {
356
399
  headerText: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-ir",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",