text-doc-ir 0.1.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.
package/dist/index.js CHANGED
@@ -1,33 +1,33 @@
1
1
  var w = Object.defineProperty;
2
- var B = (L, m, t) => m in L ? w(L, m, { enumerable: !0, configurable: !0, writable: !0, value: t }) : L[m] = t;
3
- var k = (L, m, t) => B(L, typeof m != "symbol" ? m + "" : m, t);
2
+ var B = (y, m, t) => m in y ? w(y, m, { enumerable: !0, configurable: !0, writable: !0, value: t }) : y[m] = t;
3
+ var C = (y, m, t) => B(y, typeof m != "symbol" ? m + "" : m, t);
4
4
  import { NodeVisitor as b } from "document-ir";
5
- function d(L, m, t) {
5
+ function d(y, m, t) {
6
6
  const e = [];
7
7
  if (m == 0)
8
8
  return "";
9
9
  do {
10
- const s = m % L.length;
11
- let n = Math.floor((m - s) / L.length);
12
- s == 0 ? (n--, e.push(L[L.length - 1])) : e.push(L[s - 1]), m = n;
10
+ const s = m % y.length;
11
+ let n = Math.floor((m - s) / y.length);
12
+ s == 0 ? (n--, e.push(y[y.length - 1])) : e.push(y[s - 1]), m = n;
13
13
  } while (m > 0);
14
14
  return e.reverse().join("");
15
15
  }
16
16
  const S = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""), T = "abcdefghijklmnopqrstuvwxyz".split("");
17
- function f(L) {
18
- return Math.max(0, L);
17
+ function f(y) {
18
+ return Math.max(0, y);
19
19
  }
20
20
  class c extends b {
21
21
  constructor(t) {
22
22
  super();
23
- k(this, "width");
24
- k(this, "lines");
25
- k(this, "lazyLines");
26
- k(this, "breakLazy");
27
- k(this, "spaceLazy");
28
- k(this, "breakCount");
29
- k(this, "eatSpaces");
30
- k(this, "state");
23
+ C(this, "width");
24
+ C(this, "lines");
25
+ C(this, "lazyLines");
26
+ C(this, "breakLazy");
27
+ C(this, "spaceLazy");
28
+ C(this, "breakCount");
29
+ C(this, "eatSpaces");
30
+ C(this, "state");
31
31
  this.width = t, this.lines = [], this.lazyLines = [], this.breakLazy = !1, this.spaceLazy = !1, this.breakCount = 0, this.eatSpaces = !0, this.state = {
32
32
  images: /* @__PURE__ */ new Map(),
33
33
  imagesReverse: /* @__PURE__ */ new Map(),
@@ -35,6 +35,8 @@ class c extends b {
35
35
  links: /* @__PURE__ */ new Map(),
36
36
  linksReverse: /* @__PURE__ */ new Map(),
37
37
  linkCount: 0,
38
+ footnotes: [],
39
+ footnoteCount: 0,
38
40
  numericDepth: 0,
39
41
  tocDepth: 0
40
42
  };
@@ -43,7 +45,7 @@ class c extends b {
43
45
  this.state = t;
44
46
  }
45
47
  restoreState(t) {
46
- t.state.imageCount = this.state.imageCount, t.state.linkCount = this.state.linkCount;
48
+ t.state.imageCount = this.state.imageCount, t.state.linkCount = this.state.linkCount, t.state.footnoteCount = this.state.footnoteCount;
47
49
  }
48
50
  choose(t) {
49
51
  switch (t.type) {
@@ -86,14 +88,14 @@ class c extends b {
86
88
  e.setState({ ...this.state, numericDepth: 0 }), e.codeAsBlock(t.content);
87
89
  const s = e.getLines();
88
90
  e.restoreState(this);
89
- const n = Math.max(...s.map((a) => a.length), t.fileName.length), i = Math.min(this.width, n + 4);
91
+ const n = Math.max(...s.map((l) => l.length), t.fileName.length), i = Math.min(this.width, n + 4);
90
92
  this.pushBlockContentBegin();
91
- const h = Math.max(0, i - t.fileName.length - 4), l = Math.floor(h / 2), o = h - l;
92
- this.pushText("/" + "-".repeat(l) + " " + t.fileName + " " + "-".repeat(o) + "\\");
93
- for (const a of s) {
93
+ const h = Math.max(0, i - t.fileName.length - 4), a = Math.floor(h / 2), o = h - a;
94
+ this.pushText("/" + "-".repeat(a) + " " + t.fileName + " " + "-".repeat(o) + "\\");
95
+ for (const l of s) {
94
96
  this.pushLine(), this.eatSpaces = !1;
95
- const r = f(i - 4 - a.length);
96
- this.pushText("| " + a + " ".repeat(r) + " |");
97
+ const r = f(i - 4 - l.length);
98
+ this.pushText("| " + l + " ".repeat(r) + " |");
97
99
  }
98
100
  this.pushLine(), this.pushText("\\" + "-".repeat(i - 2) + "/"), this.pushBlockContentEnd();
99
101
  }
@@ -105,18 +107,18 @@ class c extends b {
105
107
  s.restoreState(this);
106
108
  const h = new c(this.width - 4);
107
109
  h.setState({ ...this.state, numericDepth: 0 }), h.codeAsBlock(e.content);
108
- const l = h.getLines();
110
+ const a = h.getLines();
109
111
  h.restoreState(this);
110
- const o = Math.max(...l.map((g) => g.length), i.length), a = Math.min(this.width, o + 4);
112
+ const o = Math.max(...a.map((g) => g.length), i.length), l = Math.min(this.width, o + 4);
111
113
  this.pushBlockContentBegin();
112
- const r = Math.max(0, a - i.length - 4), p = Math.floor(r / 2), u = r - p;
114
+ const r = Math.max(0, l - i.length - 4), p = Math.floor(r / 2), u = r - p;
113
115
  this.pushText("/" + "-".repeat(p) + " " + i + " " + "-".repeat(u) + "\\");
114
- for (const g of l) {
116
+ for (const g of a) {
115
117
  this.pushLine(), this.eatSpaces = !1;
116
- const C = f(a - 4 - g.length);
117
- this.pushText("| " + g + " ".repeat(C) + " |");
118
+ const k = f(l - 4 - g.length);
119
+ this.pushText("| " + g + " ".repeat(k) + " |");
118
120
  }
119
- this.pushLine(), this.pushText("\\" + "-".repeat(a - 2) + "/"), this.pushBlockContentEnd();
121
+ this.pushLine(), this.pushText("\\" + "-".repeat(l - 2) + "/"), this.pushBlockContentEnd();
120
122
  }
121
123
  }
122
124
  accordionGroup(t) {
@@ -134,6 +136,35 @@ class c extends b {
134
136
  }
135
137
  this.pushBlockContentBegin(), this.chooseChildren(t.header), this.pushBlockContentEnd(), this.pushBlockContentBegin(), this.chooseChildren(t.content), this.pushBlockContentEnd();
136
138
  }
139
+ badge(t) {
140
+ let e;
141
+ this.state.images.has(t.url) ? e = this.state.images.get(t.url) || "unreachable" : (this.state.imageCount++, e = `I${this.state.imageCount}`, this.state.images.set(t.url, e), this.state.imagesReverse.set(e, t.url)), this.spaceLazy = !0, this.pushText(
142
+ `[${e}: ${(t.alt || "unspecified").replaceAll(/[\n\r\t]/g, " ")}]`
143
+ ), this.spaceLazy = !0;
144
+ }
145
+ footnote(t) {
146
+ this.state.footnoteCount++;
147
+ const e = `f${this.state.footnoteCount}`;
148
+ this.state.footnotes.push({ key: e, content: t.content }), this.pushText(`[${e}]`);
149
+ }
150
+ footnoteDisplay(t) {
151
+ this.renderFootnotes();
152
+ }
153
+ renderFootnotes() {
154
+ if (this.state.footnotes.length === 0)
155
+ return;
156
+ this.pushBlockContentBegin();
157
+ const e = `[${this.state.footnotes[this.state.footnotes.length - 1].key}]: `.length;
158
+ for (const s of this.state.footnotes) {
159
+ const n = `[${s.key}]: `, i = new c(this.width - e);
160
+ i.setState({ ...this.state, numericDepth: 0 }), i.visit({ type: "array", content: s.content });
161
+ let h = !0;
162
+ for (const a of i.getLines())
163
+ this.pushEndOfLineIfAnyContent(), h ? (this.lines[Math.max(0, this.lines.length - 1)] = " ".repeat(e - n.length) + n + a, h = !1) : this.lines[Math.max(0, this.lines.length - 1)] = " ".repeat(e) + a;
164
+ i.restoreState(this);
165
+ }
166
+ this.state.footnotes = [], this.pushBlockContentEnd();
167
+ }
137
168
  pill(t) {
138
169
  this.pushText("["), this.chooseChildren(t.content), this.pushText("]");
139
170
  }
@@ -167,11 +198,11 @@ class c extends b {
167
198
  ...this.state,
168
199
  numericDepth: this.state.numericDepth + 1
169
200
  }), h.visit({ type: "array", content: n.content });
170
- const l = h.getLines();
171
- for (let o = 0; o < l.length; o++)
201
+ const a = h.getLines();
202
+ for (let o = 0; o < a.length; o++)
172
203
  o == 0 ? this.lines.push(
173
- `${" ".repeat(s - i.length - 2)}${i}. ${l[0]}`
174
- ) : l[o] == "" ? this.lines.push("") : this.lines.push(" ".repeat(s) + l[o]);
204
+ `${" ".repeat(s - i.length - 2)}${i}. ${a[0]}`
205
+ ) : a[o] == "" ? this.lines.push("") : this.lines.push(" ".repeat(s) + a[o]);
175
206
  h.restoreState(this);
176
207
  }
177
208
  } else
@@ -186,7 +217,7 @@ class c extends b {
186
217
  this.pushBlockContentEnd();
187
218
  }
188
219
  columns(t) {
189
- var l;
220
+ var a;
190
221
  const e = t["column-count"];
191
222
  if (e == 1) {
192
223
  this.visit({ type: "array", content: t.columns[0] });
@@ -197,20 +228,20 @@ class c extends b {
197
228
  let h = 0;
198
229
  for (let o = 0; o < e; o++) {
199
230
  o > 0 && (s += 2);
200
- const a = o == e - 1 ? this.width - s : n, r = new c(a);
231
+ const l = o == e - 1 ? this.width - s : n, r = new c(l);
201
232
  r.setState({ ...this.state, numericDepth: 0 }), r.visit({ type: "array", content: t.columns[o] });
202
233
  const p = r.getLines();
203
- i.push(p), h = Math.max(h, p.length), s += a, r.restoreState(this);
234
+ i.push(p), h = Math.max(h, p.length), s += l, r.restoreState(this);
204
235
  }
205
236
  this.pushBlockContentBegin();
206
237
  for (let o = 0; o < h; o++) {
207
- let a = "";
238
+ let l = "";
208
239
  for (let r = 0; r < e; r++) {
209
- r > 0 && (a += " ");
210
- const p = ((l = i[r]) == null ? void 0 : l[o]) ?? "";
211
- a += p + " ".repeat(f(n - p.length));
240
+ r > 0 && (l += " ");
241
+ const p = ((a = i[r]) == null ? void 0 : a[o]) ?? "";
242
+ l += p + " ".repeat(f(n - p.length));
212
243
  }
213
- this.lines.push(a.trimEnd());
244
+ this.lines.push(l.trimEnd());
214
245
  }
215
246
  this.pushBlockContentEnd();
216
247
  }
@@ -256,8 +287,8 @@ class c extends b {
256
287
  const s = this.lines.length;
257
288
  let n = 1;
258
289
  for (let h = e; h < s; h++) {
259
- const l = this.lines[h];
260
- n = Math.min(this.width, l.length);
290
+ const a = this.lines[h];
291
+ n = Math.min(this.width, a.length);
261
292
  }
262
293
  this.pushLine();
263
294
  let i = "=";
@@ -319,6 +350,13 @@ class c extends b {
319
350
  content: [{ type: "text", text: "Toot" }]
320
351
  });
321
352
  break;
353
+ case "bluesky":
354
+ this.link({
355
+ type: "link",
356
+ url: `https://bsky.app/post/${t.id}`,
357
+ content: [{ type: "text", text: "Bluesky Post" }]
358
+ });
359
+ break;
322
360
  case "vimeo":
323
361
  this.link({
324
362
  type: "link",
@@ -344,41 +382,41 @@ class c extends b {
344
382
  }
345
383
  table(t) {
346
384
  this.pushBlockContentBegin();
347
- const e = [], s = Math.max(...t.content.map((l) => l.length)), n = new Array(s).fill(0), i = [];
348
- for (const l of t.content) {
385
+ const e = [], s = Math.max(...t.content.map((a) => a.length)), n = new Array(s).fill(0), i = [];
386
+ for (const a of t.content) {
349
387
  const o = [];
350
- let a = !1;
351
- for (let r = 0; r < l.length; r++) {
352
- const p = l[r];
353
- p.header && (a = !0);
388
+ let l = !1;
389
+ for (let r = 0; r < a.length; r++) {
390
+ const p = a[r];
391
+ p.header && (l = !0);
354
392
  const u = Math.max(
355
393
  5,
356
394
  Math.floor((this.width - s * 3 - 1) / s)
357
395
  ), g = new c(u);
358
396
  g.setState({ ...this.state, numericDepth: 0 }), g.visit({ type: "array", content: p.content });
359
- const C = [...g.getLines()];
360
- o.push(C);
361
- const y = Math.max(...C.map((x) => x.length), 0);
362
- n[r] = Math.max(n[r], y), g.restoreState(this);
397
+ const k = [...g.getLines()];
398
+ o.push(k);
399
+ const L = Math.max(...k.map((x) => x.length), 0);
400
+ n[r] = Math.max(n[r], L), g.restoreState(this);
363
401
  }
364
- e.push(o), i.push(a);
402
+ e.push(o), i.push(l);
365
403
  }
366
- for (let l = 0; l < s; l++)
367
- n[l] = Math.max(n[l], 3);
368
- const h = (l) => "+" + n.map((o) => l.repeat(o + 2)).join("+") + "+";
404
+ for (let a = 0; a < s; a++)
405
+ n[a] = Math.max(n[a], 3);
406
+ const h = (a) => "+" + n.map((o) => a.repeat(o + 2)).join("+") + "+";
369
407
  this.pushText(h("-"));
370
- for (let l = 0; l < e.length; l++) {
371
- const o = e[l], a = Math.max(...o.map((r) => r.length), 1);
372
- for (let r = 0; r < a; r++) {
408
+ for (let a = 0; a < e.length; a++) {
409
+ const o = e[a], l = Math.max(...o.map((r) => r.length), 1);
410
+ for (let r = 0; r < l; r++) {
373
411
  this.pushLine();
374
412
  let p = "|";
375
413
  for (let u = 0; u < s; u++) {
376
- const C = (o[u] || [])[r] || "", y = n[u];
377
- p += " " + C + " ".repeat(f(y - C.length)) + " |";
414
+ const k = (o[u] || [])[r] || "", L = n[u];
415
+ p += " " + k + " ".repeat(f(L - k.length)) + " |";
378
416
  }
379
417
  this.pushText(p);
380
418
  }
381
- this.pushLine(), i[l] ? this.pushText(h("=")) : this.pushText(h("-"));
419
+ this.pushLine(), i[a] ? this.pushText(h("=")) : this.pushText(h("-"));
382
420
  }
383
421
  this.pushBlockContentEnd();
384
422
  }
@@ -498,8 +536,8 @@ class c extends b {
498
536
  else if (t.orientation == "right")
499
537
  this.lines[Math.max(0, this.lines.length - 1)] = "|" + " ".repeat(i) + n + " |";
500
538
  else if (t.orientation == "center") {
501
- const h = Math.floor(i / 2), l = i - h;
502
- this.lines[Math.max(0, this.lines.length - 1)] = "|" + " ".repeat(h + 1) + n + " ".repeat(l) + "|";
539
+ const h = Math.floor(i / 2), a = i - h;
540
+ this.lines[Math.max(0, this.lines.length - 1)] = "|" + " ".repeat(h + 1) + n + " ".repeat(a) + "|";
503
541
  }
504
542
  }
505
543
  this.pushEndOfLineIfAnyContent(), this.pushText("\\"), this.pushText("-".repeat(this.width - 2)), this.pushText("/"), e.restoreState(this), this.pushBlockContentEnd();
@@ -614,10 +652,10 @@ class c extends b {
614
652
  content: t.children
615
653
  });
616
654
  const s = 19, n = e.getLines(), i = n.reduce(
617
- (o, a) => Math.max(o, a.length + 1),
655
+ (o, l) => Math.max(o, l.length + 1),
618
656
  s + 2
619
- ), h = Math.floor((i - s) / 2) + 1, l = i - s - h + 1;
620
- this.pushBlockContentBegin(), this.lines[Math.max(0, this.lines.length - 1)] = "/" + "-".repeat(f(h)) + " Table of contents " + "-".repeat(f(l)) + "\\";
657
+ ), h = Math.floor((i - s) / 2) + 1, a = i - s - h + 1;
658
+ this.pushBlockContentBegin(), this.lines[Math.max(0, this.lines.length - 1)] = "/" + "-".repeat(f(h)) + " Table of contents " + "-".repeat(f(a)) + "\\";
621
659
  for (const o of n)
622
660
  this.pushEndOfLineIfAnyContent(), this.lines[Math.max(0, this.lines.length - 1)] = "| " + o + " ".repeat(f(i - o.length)) + "|";
623
661
  this.pushEndOfLineIfAnyContent(), this.lines[Math.max(0, this.lines.length - 1)] = "\\" + "-".repeat(i + 1) + "/", e.restoreState(this), this.pushBlockContentEnd();
@@ -641,18 +679,18 @@ class c extends b {
641
679
  ...t.description && [{ type: "text", text: t.description }] || [],
642
680
  { type: "horizontal-rule" }
643
681
  ]
644
- }), this.beforeBlock(), this.chooseChildren(t.content), this.afterBlock(), this.horizontalRule({ type: "horizontal-rule" }), this.beforeBlock(), t.definitions && this.chooseChildren(t.definitions), this.afterBlock(), this.pushLine(), this.state.linkCount > 0) {
682
+ }), this.beforeBlock(), this.chooseChildren(t.content), this.afterBlock(), this.horizontalRule({ type: "horizontal-rule" }), this.beforeBlock(), t.definitions && this.chooseChildren(t.definitions), this.afterBlock(), this.renderFootnotes(), this.pushLine(), this.state.linkCount > 0) {
645
683
  this.beforeBlock();
646
684
  const s = this.state.linkCount, n = Math.max(7, `[L${s}]: `.length);
647
685
  for (let i = 1; i <= s; i++) {
648
- const h = `[L${i}]: `, l = new c(this.width - n);
649
- l.text({
686
+ const h = `[L${i}]: `, a = new c(this.width - n);
687
+ a.text({
650
688
  type: "text",
651
689
  text: this.state.linksReverse.get(`L${i}`) || ""
652
690
  });
653
691
  let o = !0;
654
- for (const a of l.getLines())
655
- o ? (this.lines.push(" ".repeat(n - h.length) + h + a), o = !1) : this.lines.push(" ".repeat(n) + a);
692
+ for (const l of a.getLines())
693
+ o ? (this.lines.push(" ".repeat(n - h.length) + h + l), o = !1) : this.lines.push(" ".repeat(n) + l);
656
694
  }
657
695
  this.state.imageCount == 0 && this.afterBlock();
658
696
  }
@@ -665,9 +703,9 @@ class c extends b {
665
703
  type: "text",
666
704
  text: this.state.imagesReverse.get(`I${n}`) || ""
667
705
  });
668
- let l = !0;
706
+ let a = !0;
669
707
  for (const o of h.getLines())
670
- l ? (this.lines.push(" ".repeat(s - i.length) + i + o), l = !1) : this.lines.push(" ".repeat(s) + o);
708
+ a ? (this.lines.push(" ".repeat(s - i.length) + i + o), a = !1) : this.lines.push(" ".repeat(s) + o);
671
709
  }
672
710
  }
673
711
  this.afterBlock();
@@ -723,20 +761,20 @@ class c extends b {
723
761
  }
724
762
  this.eatSpaces = !0;
725
763
  let i = n + this.width - s.length, h = t.slice(n, i);
726
- const l = t.slice(i, i + 1);
764
+ const a = t.slice(i, i + 1);
727
765
  if (h == "")
728
766
  break;
729
- if (l && l.match(/[a-zA-Z0-9.?,\])}>]/)) {
767
+ if (a && a.match(/[a-zA-Z0-9.?,\])}>]/)) {
730
768
  let o = !1;
731
- for (let a = 0; a < h.length; a++) {
732
- const r = h.length - 1 - a, p = h.charAt(r);
769
+ for (let l = 0; l < h.length; l++) {
770
+ const r = h.length - 1 - l, p = h.charAt(r);
733
771
  if (p && p.match(/[ =\-_/\\\n\r\t]/)) {
734
- i -= a, h = t.slice(n, i), o = !0;
772
+ i -= l, h = t.slice(n, i), o = !0;
735
773
  break;
736
774
  }
737
775
  }
738
776
  o ? (this.lines[e] = s + h, this.lines[e].length > this.width && console.log("oops 1")) : this.getLastLine().length > 0 ? (i = n, this.lines[e] = s) : this.lines[e] = s + h, this.pushLine(), e++, s = this.lines[e], n = i;
739
- } else if (this.lines[e] = s + h, n = i, l == "")
777
+ } else if (this.lines[e] = s + h, n = i, a == "")
740
778
  break;
741
779
  this.lines[e].length == this.width && (this.pushLine(), e++, s = this.lines[e]);
742
780
  }
@@ -753,23 +791,23 @@ class c extends b {
753
791
  if (!e && !s)
754
792
  return t;
755
793
  let n = 0, i = 0;
756
- const h = t.map((o) => e ? o.startsWith("+") ? (i++, { text: o.slice(1), prefix: "+", oldNo: null, newNo: i }) : o.startsWith("-") ? (n++, { text: o.slice(1), prefix: "-", oldNo: n, newNo: null }) : (n++, i++, { text: o, prefix: " ", oldNo: n, newNo: i }) : (i++, { text: o, prefix: " ", oldNo: null, newNo: i })), l = [];
794
+ const h = t.map((o) => e ? o.startsWith("+") ? (i++, { text: o.slice(1), prefix: "+", oldNo: null, newNo: i }) : o.startsWith("-") ? (n++, { text: o.slice(1), prefix: "-", oldNo: n, newNo: null }) : (n++, i++, { text: o, prefix: " ", oldNo: n, newNo: i }) : (i++, { text: o, prefix: " ", oldNo: null, newNo: i })), a = [];
757
795
  if (s && e) {
758
- const o = h.reduce((u, g) => Math.max(u, g.oldNo ?? 0), 0), a = h.reduce((u, g) => Math.max(u, g.newNo ?? 0), 0), r = Math.max(String(o).length, 1), p = Math.max(String(a).length, 1);
796
+ const o = h.reduce((u, g) => Math.max(u, g.oldNo ?? 0), 0), l = h.reduce((u, g) => Math.max(u, g.newNo ?? 0), 0), r = Math.max(String(o).length, 1), p = Math.max(String(l).length, 1);
759
797
  for (const u of h) {
760
- const g = u.oldNo !== null ? String(u.oldNo).padStart(r) : " ".repeat(r), C = u.newNo !== null ? String(u.newNo).padStart(p) : " ".repeat(p);
761
- l.push(`${g} ${C} ${u.prefix} ${u.text}`);
798
+ const g = u.oldNo !== null ? String(u.oldNo).padStart(r) : " ".repeat(r), k = u.newNo !== null ? String(u.newNo).padStart(p) : " ".repeat(p);
799
+ a.push(`${g} ${k} ${u.prefix} ${u.text}`);
762
800
  }
763
801
  } else if (s) {
764
- const o = h.length, a = String(o).length;
802
+ const o = h.length, l = String(o).length;
765
803
  for (const r of h) {
766
- const p = String(r.newNo ?? 0).padStart(a);
767
- l.push(`${p} | ${r.text}`);
804
+ const p = String(r.newNo ?? 0).padStart(l);
805
+ a.push(`${p} | ${r.text}`);
768
806
  }
769
807
  } else if (e)
770
808
  for (const o of h)
771
- l.push(`${o.prefix} ${o.text}`);
772
- return l;
809
+ a.push(`${o.prefix} ${o.text}`);
810
+ return a;
773
811
  }
774
812
  getLines() {
775
813
  return this.lines;
package/dist/main.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AccordionGroupNode, AccordionTabNode, BlockQuoteNode, BreakNode, BubbleNode, CardNode, CenterNode, CodeBlockNode, CodeGroupNode, CodeNode, ColumnsNode, DateNode, DateTimeNode, DefinitionListNode, DefinitionNode, DefinitionReferenceNode, DocumentNode, EmbedNode, EmojiNode, FigureCaptionNode, FigureImageNode, FigureNode, FormattedTextNode, HeaderNode, HighTechAlertNode, HorizontalRuleNode, ImageNode, LinkNode, ListNode, Node, NoteNode, ParagraphNode, PillNode, QuoteNode, RedactedNode, RegionNode, SecretNode, SocialNode, StandardNode, StickerNode, StrikeThroughNode, SubTextNode, SuperTextNode, TableNode, TableOfContentsNode, TextNode, TimeNode, TimeRangeNode, VideoNode, WarningNode, NodeVisitor } from 'document-ir';
1
+ import { AccordionGroupNode, AccordionTabNode, BadgeNode, BlockQuoteNode, BreakNode, BubbleNode, CardNode, CenterNode, CodeBlockNode, CodeGroupNode, CodeNode, ColumnsNode, DateNode, DateTimeNode, DefinitionListNode, DefinitionNode, DefinitionReferenceNode, DocumentNode, EmbedNode, EmojiNode, FigureCaptionNode, FigureImageNode, FigureNode, FootnoteNode, FootnoteDisplayNode, FormattedTextNode, HeaderNode, HighTechAlertNode, HorizontalRuleNode, ImageNode, LinkNode, ListNode, Node, NoteNode, ParagraphNode, PillNode, QuoteNode, RedactedNode, RegionNode, SecretNode, SocialNode, StandardNode, StickerNode, StrikeThroughNode, SubTextNode, SuperTextNode, TableNode, TableOfContentsNode, TextNode, TimeNode, TimeRangeNode, VideoNode, WarningNode, NodeVisitor } from 'document-ir';
2
2
  export declare class FixedWidthTextVisitor extends NodeVisitor {
3
3
  private width;
4
4
  private lines;
@@ -18,6 +18,10 @@ export declare class FixedWidthTextVisitor extends NodeVisitor {
18
18
  protected codeGroup(node: CodeGroupNode): void;
19
19
  protected accordionGroup(node: AccordionGroupNode): void;
20
20
  protected accordionTab(node: AccordionTabNode): void;
21
+ protected badge(node: BadgeNode): void;
22
+ protected footnote(node: FootnoteNode): void;
23
+ protected footnoteDisplay(_node: FootnoteDisplayNode): void;
24
+ private renderFootnotes;
21
25
  protected pill(node: PillNode): void;
22
26
  protected text(node: TextNode): void;
23
27
  protected formattedText(node: FormattedTextNode): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "text-doc-ir",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Transforms a document intermediate representation into plain text with formatting",
@@ -44,7 +44,7 @@
44
44
  "to-text": "bun src/to-text.ts"
45
45
  },
46
46
  "dependencies": {
47
- "document-ir": "0.3.0"
47
+ "document-ir": "0.5.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/bun": "latest",