@podlite/markdown 0.0.1

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.
@@ -0,0 +1,1160 @@
1
+ import { isValidateError } from "@podlite/schema";
2
+ import { validateAstTree } from "@podlite/schema";
3
+ import { validateAst } from "@podlite/schema";
4
+ import { frozenIds } from "podlite/src";
5
+ import { md2ast } from "../src/tools";
6
+ import { podlite as podlite_core } from "podlite";
7
+ import { PodliteDocument } from "@podlite/schema";
8
+
9
+ const process = (src) => {
10
+ return frozenIds()(md2ast(src));
11
+ };
12
+
13
+ export const parse = (str: string): PodliteDocument => {
14
+ let podlite = podlite_core({ importPlugins: false }).use({});
15
+ let tree = podlite.parse(str);
16
+ const asAst = podlite.toAstResult(tree);
17
+ return asAst.interator;
18
+ };
19
+ it("=Markdown: parse para", () => {
20
+ const pod = `text`;
21
+ // const tree1 = parse(pod);
22
+ const tree = process(pod);
23
+ const r = validateAstTree([tree]);
24
+ expect(r).toEqual([]);
25
+ const errorDescribe = isValidateError(r, tree);
26
+ expect(process(pod)).toMatchInlineSnapshot(`
27
+ Object {
28
+ "content": Array [
29
+ Object {
30
+ "content": Array [
31
+ "text",
32
+ ],
33
+ "id": "id",
34
+ "location": Object {
35
+ "end": Object {
36
+ "column": 5,
37
+ "line": 1,
38
+ "offset": 4,
39
+ },
40
+ "start": Object {
41
+ "column": 1,
42
+ "line": 1,
43
+ "offset": 0,
44
+ },
45
+ },
46
+ "margin": "",
47
+ "text": "text",
48
+ "type": "para",
49
+ },
50
+ ],
51
+ "id": "id",
52
+ "margin": "",
53
+ "name": "root",
54
+ "type": "block",
55
+ }
56
+ `);
57
+ });
58
+
59
+ it.skip("[markdown]: parse para", () => {
60
+ const pod = `text`;
61
+ const tree = process(pod);
62
+ // console.log(JSON.stringify(tree, null, 2));
63
+ // console.log(JSON.stringify(parse(`L<https://uerl>`), null, 2));
64
+ const r = validateAstTree([tree]);
65
+ expect(r).toEqual([]);
66
+ const errorDescribe = isValidateError(r, tree);
67
+ // expect(process(pod)).toMatchInlineSnapshot();
68
+ });
69
+
70
+ it("[markdown]: parse headers", () => {
71
+ const pod = `## build
72
+
73
+ Generate JavaScript documentation as a list of parsed JSDoc
74
+ comments, given a root file as a path`;
75
+ const tree = process(pod);
76
+ const r = validateAstTree([tree]);
77
+ expect(r).toEqual([]);
78
+ const errorDescribe = isValidateError(r, tree);
79
+ expect(process(pod)).toMatchInlineSnapshot(`
80
+ Object {
81
+ "content": Array [
82
+ Object {
83
+ "content": Array [
84
+ "build",
85
+ ],
86
+ "id": "id",
87
+ "level": 2,
88
+ "location": Object {
89
+ "end": Object {
90
+ "column": 9,
91
+ "line": 1,
92
+ "offset": 8,
93
+ },
94
+ "start": Object {
95
+ "column": 1,
96
+ "line": 1,
97
+ "offset": 0,
98
+ },
99
+ },
100
+ "margin": "",
101
+ "name": "head",
102
+ "type": "block",
103
+ },
104
+ Object {
105
+ "content": Array [
106
+ "Generate JavaScript documentation as a list of parsed JSDoc
107
+ comments, given a root file as a path",
108
+ ],
109
+ "id": "id",
110
+ "location": Object {
111
+ "end": Object {
112
+ "column": 38,
113
+ "line": 4,
114
+ "offset": 107,
115
+ },
116
+ "start": Object {
117
+ "column": 1,
118
+ "line": 3,
119
+ "offset": 10,
120
+ },
121
+ },
122
+ "margin": "",
123
+ "text": "text",
124
+ "type": "para",
125
+ },
126
+ ],
127
+ "id": "id",
128
+ "margin": "",
129
+ "name": "root",
130
+ "type": "block",
131
+ }
132
+ `);
133
+ });
134
+ it("[markdown]: parse link", () => {
135
+ const pod = `[#raku IRC channel](https://raku.org/community/irc)`;
136
+ const tree = process(pod);
137
+ const r = validateAstTree([tree]);
138
+ expect(r).toEqual([]);
139
+ const errorDescribe = isValidateError(r, tree);
140
+ expect(process(pod)).toMatchInlineSnapshot(`
141
+ Object {
142
+ "content": Array [
143
+ Object {
144
+ "content": Array [
145
+ Object {
146
+ "content": Array [
147
+ "#raku IRC channel",
148
+ ],
149
+ "meta": "https://raku.org/community/irc",
150
+ "name": "L",
151
+ "type": "fcode",
152
+ },
153
+ ],
154
+ "id": "id",
155
+ "location": Object {
156
+ "end": Object {
157
+ "column": 52,
158
+ "line": 1,
159
+ "offset": 51,
160
+ },
161
+ "start": Object {
162
+ "column": 1,
163
+ "line": 1,
164
+ "offset": 0,
165
+ },
166
+ },
167
+ "margin": "",
168
+ "text": "text",
169
+ "type": "para",
170
+ },
171
+ ],
172
+ "id": "id",
173
+ "margin": "",
174
+ "name": "root",
175
+ "type": "block",
176
+ }
177
+ `);
178
+ });
179
+ it("[markdown]: parse image", () => {
180
+ const pod = `![foo](/url "title")`;
181
+ const tree = process(pod);
182
+ const r = validateAstTree([tree]);
183
+ expect(r).toEqual([]);
184
+ const errorDescribe = isValidateError(r, tree);
185
+ expect(process(pod)).toMatchInlineSnapshot(`
186
+ Object {
187
+ "content": Array [
188
+ Object {
189
+ "content": Array [
190
+ Object {
191
+ "config": Array [],
192
+ "content": Array [
193
+ Object {
194
+ "alt": "foo",
195
+ "src": "/url",
196
+ "type": "image",
197
+ },
198
+ Object {
199
+ "content": Array [
200
+ "title",
201
+ ],
202
+ "name": "caption",
203
+ "type": "block",
204
+ },
205
+ ],
206
+ "id": "id",
207
+ "location": Object {
208
+ "end": Object {
209
+ "column": 21,
210
+ "line": 1,
211
+ "offset": 20,
212
+ },
213
+ "start": Object {
214
+ "column": 1,
215
+ "line": 1,
216
+ "offset": 0,
217
+ },
218
+ },
219
+ "margin": "",
220
+ "name": "Image",
221
+ "type": "block",
222
+ },
223
+ ],
224
+ "id": "id",
225
+ "location": Object {
226
+ "end": Object {
227
+ "column": 21,
228
+ "line": 1,
229
+ "offset": 20,
230
+ },
231
+ "start": Object {
232
+ "column": 1,
233
+ "line": 1,
234
+ "offset": 0,
235
+ },
236
+ },
237
+ "margin": "",
238
+ "text": "text",
239
+ "type": "para",
240
+ },
241
+ ],
242
+ "id": "id",
243
+ "margin": "",
244
+ "name": "root",
245
+ "type": "block",
246
+ }
247
+ `);
248
+ });
249
+
250
+ it("[markdown]: parse refs", () => {
251
+ const pod = `### Table of Contents
252
+
253
+ - [lint][1]
254
+ - [Parameters][2]
255
+
256
+
257
+ [1]: #lint
258
+
259
+ [2]: #parameters`;
260
+ const tree = process(pod);
261
+ const r = validateAstTree([tree]);
262
+ expect(r).toEqual([]);
263
+ const errorDescribe = isValidateError(r, tree);
264
+ expect(process(pod)).toMatchInlineSnapshot(`
265
+ Object {
266
+ "content": Array [
267
+ Object {
268
+ "content": Array [
269
+ "Table of Contents",
270
+ ],
271
+ "id": "id",
272
+ "level": 3,
273
+ "location": Object {
274
+ "end": Object {
275
+ "column": 22,
276
+ "line": 1,
277
+ "offset": 21,
278
+ },
279
+ "start": Object {
280
+ "column": 1,
281
+ "line": 1,
282
+ "offset": 0,
283
+ },
284
+ },
285
+ "margin": "",
286
+ "name": "head",
287
+ "type": "block",
288
+ },
289
+ Object {
290
+ "content": Array [
291
+ Object {
292
+ "content": Array [
293
+ Object {
294
+ "content": Array [
295
+ Object {
296
+ "content": Array [
297
+ "lint",
298
+ ],
299
+ "meta": "#lint",
300
+ "name": "L",
301
+ "type": "fcode",
302
+ },
303
+ ],
304
+ "id": "id",
305
+ "location": Object {
306
+ "end": Object {
307
+ "column": 14,
308
+ "line": 3,
309
+ "offset": 36,
310
+ },
311
+ "start": Object {
312
+ "column": 5,
313
+ "line": 3,
314
+ "offset": 27,
315
+ },
316
+ },
317
+ "margin": "",
318
+ "text": "text",
319
+ "type": "para",
320
+ },
321
+ Object {
322
+ "content": Array [
323
+ Object {
324
+ "content": Array [
325
+ Object {
326
+ "content": Array [
327
+ Object {
328
+ "content": Array [
329
+ "Parameters",
330
+ ],
331
+ "meta": "#parameters",
332
+ "name": "L",
333
+ "type": "fcode",
334
+ },
335
+ ],
336
+ "id": "id",
337
+ "location": Object {
338
+ "end": Object {
339
+ "column": 24,
340
+ "line": 4,
341
+ "offset": 60,
342
+ },
343
+ "start": Object {
344
+ "column": 9,
345
+ "line": 4,
346
+ "offset": 45,
347
+ },
348
+ },
349
+ "margin": "",
350
+ "text": "text",
351
+ "type": "para",
352
+ },
353
+ ],
354
+ "id": "id",
355
+ "level": 2,
356
+ "location": Object {
357
+ "end": Object {
358
+ "column": 24,
359
+ "line": 4,
360
+ "offset": 60,
361
+ },
362
+ "start": Object {
363
+ "column": 5,
364
+ "line": 4,
365
+ "offset": 41,
366
+ },
367
+ },
368
+ "margin": "",
369
+ "name": "item",
370
+ "type": "block",
371
+ },
372
+ ],
373
+ "id": "id",
374
+ "level": 2,
375
+ "list": "itemized",
376
+ "margin": "",
377
+ "type": "list",
378
+ },
379
+ ],
380
+ "id": "id",
381
+ "level": 1,
382
+ "location": Object {
383
+ "end": Object {
384
+ "column": 24,
385
+ "line": 4,
386
+ "offset": 60,
387
+ },
388
+ "start": Object {
389
+ "column": 1,
390
+ "line": 3,
391
+ "offset": 23,
392
+ },
393
+ },
394
+ "margin": "",
395
+ "name": "item",
396
+ "type": "block",
397
+ },
398
+ ],
399
+ "id": "id",
400
+ "level": 1,
401
+ "list": "itemized",
402
+ "margin": "",
403
+ "type": "list",
404
+ },
405
+ ],
406
+ "id": "id",
407
+ "margin": "",
408
+ "name": "root",
409
+ "type": "block",
410
+ }
411
+ `);
412
+ });
413
+
414
+ it("[markdown]: broken_refs", () => {
415
+ const pod = `### Parameters
416
+
417
+ - \`comments\` **[Array][17]&lt;[Object][19]>** parsed comments
418
+ - \`args\` **[Object][19]** Options that can customize the output
419
+ `;
420
+ const tree = process(pod);
421
+ const r = validateAstTree([tree]);
422
+ expect(r).toEqual([]);
423
+ const errorDescribe = isValidateError(r, tree);
424
+ expect(process(pod)).toMatchInlineSnapshot(`
425
+ Object {
426
+ "content": Array [
427
+ Object {
428
+ "content": Array [
429
+ "Parameters",
430
+ ],
431
+ "id": "id",
432
+ "level": 3,
433
+ "location": Object {
434
+ "end": Object {
435
+ "column": 15,
436
+ "line": 1,
437
+ "offset": 14,
438
+ },
439
+ "start": Object {
440
+ "column": 1,
441
+ "line": 1,
442
+ "offset": 0,
443
+ },
444
+ },
445
+ "margin": "",
446
+ "name": "head",
447
+ "type": "block",
448
+ },
449
+ Object {
450
+ "content": Array [
451
+ Object {
452
+ "content": Array [
453
+ Object {
454
+ "content": Array [
455
+ Object {
456
+ "content": Array [
457
+ "comments",
458
+ ],
459
+ "name": "C",
460
+ "type": "fcode",
461
+ },
462
+ " ",
463
+ Object {
464
+ "content": Array [
465
+ "[Array][17]<[Object][19]>",
466
+ ],
467
+ "name": "B",
468
+ "type": "fcode",
469
+ },
470
+ " parsed comments",
471
+ ],
472
+ "id": "id",
473
+ "location": Object {
474
+ "end": Object {
475
+ "column": 64,
476
+ "line": 3,
477
+ "offset": 79,
478
+ },
479
+ "start": Object {
480
+ "column": 5,
481
+ "line": 3,
482
+ "offset": 20,
483
+ },
484
+ },
485
+ "margin": "",
486
+ "text": "text",
487
+ "type": "para",
488
+ },
489
+ ],
490
+ "id": "id",
491
+ "level": 1,
492
+ "location": Object {
493
+ "end": Object {
494
+ "column": 64,
495
+ "line": 3,
496
+ "offset": 79,
497
+ },
498
+ "start": Object {
499
+ "column": 1,
500
+ "line": 3,
501
+ "offset": 16,
502
+ },
503
+ },
504
+ "margin": "",
505
+ "name": "item",
506
+ "type": "block",
507
+ },
508
+ Object {
509
+ "content": Array [
510
+ Object {
511
+ "content": Array [
512
+ Object {
513
+ "content": Array [
514
+ "args",
515
+ ],
516
+ "name": "C",
517
+ "type": "fcode",
518
+ },
519
+ " ",
520
+ Object {
521
+ "content": Array [
522
+ "[Object][19]",
523
+ ],
524
+ "name": "B",
525
+ "type": "fcode",
526
+ },
527
+ " Options that can customize the output",
528
+ ],
529
+ "id": "id",
530
+ "location": Object {
531
+ "end": Object {
532
+ "column": 66,
533
+ "line": 4,
534
+ "offset": 145,
535
+ },
536
+ "start": Object {
537
+ "column": 5,
538
+ "line": 4,
539
+ "offset": 84,
540
+ },
541
+ },
542
+ "margin": "",
543
+ "text": "text",
544
+ "type": "para",
545
+ },
546
+ ],
547
+ "id": "id",
548
+ "level": 1,
549
+ "location": Object {
550
+ "end": Object {
551
+ "column": 66,
552
+ "line": 4,
553
+ "offset": 145,
554
+ },
555
+ "start": Object {
556
+ "column": 1,
557
+ "line": 4,
558
+ "offset": 80,
559
+ },
560
+ },
561
+ "margin": "",
562
+ "name": "item",
563
+ "type": "block",
564
+ },
565
+ ],
566
+ "id": "id",
567
+ "level": 1,
568
+ "list": "itemized",
569
+ "margin": "",
570
+ "type": "list",
571
+ },
572
+ ],
573
+ "id": "id",
574
+ "margin": "",
575
+ "name": "root",
576
+ "type": "block",
577
+ }
578
+ `);
579
+ });
580
+
581
+ it("[markdown]: parse code", () => {
582
+ const pod = `
583
+ \`\`\`javascript
584
+ var documentation = require('documentation');
585
+ \`\`\`
586
+ `;
587
+ const tree = process(pod);
588
+ const r = validateAstTree([tree]);
589
+ expect(r).toEqual([]);
590
+ const errorDescribe = isValidateError(r, tree);
591
+ expect(process(pod)).toMatchInlineSnapshot(`
592
+ Object {
593
+ "content": Array [
594
+ Object {
595
+ "config": Array [
596
+ Object {
597
+ "name": "lang",
598
+ "type": "string",
599
+ "value": "javascript",
600
+ },
601
+ ],
602
+ "content": Array [
603
+ Object {
604
+ "type": "verbatim",
605
+ "value": "var documentation = require('documentation');",
606
+ },
607
+ ],
608
+ "id": "id",
609
+ "location": Object {
610
+ "end": Object {
611
+ "column": 4,
612
+ "line": 4,
613
+ "offset": 64,
614
+ },
615
+ "start": Object {
616
+ "column": 1,
617
+ "line": 2,
618
+ "offset": 1,
619
+ },
620
+ },
621
+ "margin": "",
622
+ "name": "code",
623
+ "type": "block",
624
+ },
625
+ ],
626
+ "id": "id",
627
+ "margin": "",
628
+ "name": "root",
629
+ "type": "block",
630
+ }
631
+ `);
632
+ });
633
+
634
+ it("[markdown]: inline_code", () => {
635
+ const pod = `
636
+ *This text will be italic*
637
+ _This will also be italic_
638
+
639
+ **This text will be bold**
640
+ __This will also be bold__
641
+
642
+ _You **can** combine them_
643
+ `;
644
+ const tree = process(pod);
645
+ const r = validateAstTree([tree]);
646
+ expect(r).toEqual([]);
647
+ const errorDescribe = isValidateError(r, tree);
648
+ expect(process(pod)).toMatchInlineSnapshot(`
649
+ Object {
650
+ "content": Array [
651
+ Object {
652
+ "content": Array [
653
+ Object {
654
+ "content": Array [
655
+ "This text will be italic",
656
+ ],
657
+ "name": "I",
658
+ "type": "fcode",
659
+ },
660
+ "
661
+ ",
662
+ Object {
663
+ "content": Array [
664
+ "This will also be italic",
665
+ ],
666
+ "name": "I",
667
+ "type": "fcode",
668
+ },
669
+ ],
670
+ "id": "id",
671
+ "location": Object {
672
+ "end": Object {
673
+ "column": 27,
674
+ "line": 3,
675
+ "offset": 54,
676
+ },
677
+ "start": Object {
678
+ "column": 1,
679
+ "line": 2,
680
+ "offset": 1,
681
+ },
682
+ },
683
+ "margin": "",
684
+ "text": "text",
685
+ "type": "para",
686
+ },
687
+ Object {
688
+ "content": Array [
689
+ Object {
690
+ "content": Array [
691
+ "This text will be bold",
692
+ ],
693
+ "name": "B",
694
+ "type": "fcode",
695
+ },
696
+ "
697
+ ",
698
+ Object {
699
+ "content": Array [
700
+ "This will also be bold",
701
+ ],
702
+ "name": "B",
703
+ "type": "fcode",
704
+ },
705
+ ],
706
+ "id": "id",
707
+ "location": Object {
708
+ "end": Object {
709
+ "column": 27,
710
+ "line": 6,
711
+ "offset": 109,
712
+ },
713
+ "start": Object {
714
+ "column": 1,
715
+ "line": 5,
716
+ "offset": 56,
717
+ },
718
+ },
719
+ "margin": "",
720
+ "text": "text",
721
+ "type": "para",
722
+ },
723
+ Object {
724
+ "content": Array [
725
+ Object {
726
+ "content": Array [
727
+ "You ",
728
+ Object {
729
+ "content": Array [
730
+ "can",
731
+ ],
732
+ "name": "B",
733
+ "type": "fcode",
734
+ },
735
+ " combine them",
736
+ ],
737
+ "name": "I",
738
+ "type": "fcode",
739
+ },
740
+ ],
741
+ "id": "id",
742
+ "location": Object {
743
+ "end": Object {
744
+ "column": 27,
745
+ "line": 8,
746
+ "offset": 137,
747
+ },
748
+ "start": Object {
749
+ "column": 1,
750
+ "line": 8,
751
+ "offset": 111,
752
+ },
753
+ },
754
+ "margin": "",
755
+ "text": "text",
756
+ "type": "para",
757
+ },
758
+ ],
759
+ "id": "id",
760
+ "margin": "",
761
+ "name": "root",
762
+ "type": "block",
763
+ }
764
+ `);
765
+ });
766
+
767
+ it("[markdown]: thematic_break", () => {
768
+ const pod = `
769
+
770
+ ---
771
+ `;
772
+ const tree = process(pod);
773
+ const r = validateAstTree([tree]);
774
+ expect(r).toEqual([]);
775
+ const errorDescribe = isValidateError(r, tree);
776
+ expect(process(pod)).toMatchInlineSnapshot(`
777
+ Object {
778
+ "content": Array [],
779
+ "id": "id",
780
+ "margin": "",
781
+ "name": "root",
782
+ "type": "block",
783
+ }
784
+ `);
785
+ });
786
+
787
+ it("[markdown]: blockquote", () => {
788
+ const pod = `
789
+ As Kanye West said:
790
+
791
+ > We're living the future so
792
+ > the present is our past.
793
+ `;
794
+ const tree = process(pod);
795
+ const r = validateAstTree([tree]);
796
+ expect(r).toEqual([]);
797
+ const errorDescribe = isValidateError(r, tree);
798
+ expect(process(pod)).toMatchInlineSnapshot(`
799
+ Object {
800
+ "content": Array [
801
+ Object {
802
+ "content": Array [
803
+ "As Kanye West said:",
804
+ ],
805
+ "id": "id",
806
+ "location": Object {
807
+ "end": Object {
808
+ "column": 20,
809
+ "line": 2,
810
+ "offset": 20,
811
+ },
812
+ "start": Object {
813
+ "column": 1,
814
+ "line": 2,
815
+ "offset": 1,
816
+ },
817
+ },
818
+ "margin": "",
819
+ "text": "text",
820
+ "type": "para",
821
+ },
822
+ Object {
823
+ "content": Array [
824
+ Object {
825
+ "content": Array [
826
+ "We're living the future so
827
+ the present is our past.",
828
+ ],
829
+ "id": "id",
830
+ "location": Object {
831
+ "end": Object {
832
+ "column": 27,
833
+ "line": 5,
834
+ "offset": 77,
835
+ },
836
+ "start": Object {
837
+ "column": 3,
838
+ "line": 4,
839
+ "offset": 24,
840
+ },
841
+ },
842
+ "margin": "",
843
+ "text": "text",
844
+ "type": "para",
845
+ },
846
+ ],
847
+ "id": "id",
848
+ "location": Object {
849
+ "end": Object {
850
+ "column": 27,
851
+ "line": 5,
852
+ "offset": 77,
853
+ },
854
+ "start": Object {
855
+ "column": 1,
856
+ "line": 4,
857
+ "offset": 22,
858
+ },
859
+ },
860
+ "margin": "",
861
+ "name": "nested",
862
+ "type": "block",
863
+ },
864
+ ],
865
+ "id": "id",
866
+ "margin": "",
867
+ "name": "root",
868
+ "type": "block",
869
+ }
870
+ `);
871
+ });
872
+
873
+ it("[markdown]: parse table", () => {
874
+ const pod = `
875
+ First Header | Second Header
876
+ ------------ | -------------
877
+ Content from cell 1 | Content from cell 2
878
+ Content in the first column | Content in the second column
879
+ `;
880
+ const tree = process(pod);
881
+ const r = validateAstTree([tree]);
882
+ expect(r).toEqual([]);
883
+ const errorDescribe = isValidateError(r, tree);
884
+ expect(process(pod)).toMatchInlineSnapshot(`
885
+ Object {
886
+ "content": Array [
887
+ Object {
888
+ "content": Array [
889
+ Object {
890
+ "content": Array [
891
+ Object {
892
+ "content": Array [
893
+ "First Header",
894
+ ],
895
+ "id": "id",
896
+ "location": Object {
897
+ "end": Object {
898
+ "column": 15,
899
+ "line": 2,
900
+ "offset": 15,
901
+ },
902
+ "start": Object {
903
+ "column": 1,
904
+ "line": 2,
905
+ "offset": 1,
906
+ },
907
+ },
908
+ "margin": "",
909
+ "name": "table_cell",
910
+ "type": "block",
911
+ },
912
+ Object {
913
+ "content": Array [
914
+ "Second Header",
915
+ ],
916
+ "id": "id",
917
+ "location": Object {
918
+ "end": Object {
919
+ "column": 29,
920
+ "line": 2,
921
+ "offset": 29,
922
+ },
923
+ "start": Object {
924
+ "column": 15,
925
+ "line": 2,
926
+ "offset": 15,
927
+ },
928
+ },
929
+ "margin": "",
930
+ "name": "table_cell",
931
+ "type": "block",
932
+ },
933
+ ],
934
+ "id": "id",
935
+ "location": Object {
936
+ "end": Object {
937
+ "column": 29,
938
+ "line": 2,
939
+ "offset": 29,
940
+ },
941
+ "start": Object {
942
+ "column": 1,
943
+ "line": 2,
944
+ "offset": 1,
945
+ },
946
+ },
947
+ "margin": "",
948
+ "name": "table_row",
949
+ "type": "block",
950
+ },
951
+ Object {
952
+ "content": Array [
953
+ Object {
954
+ "content": Array [
955
+ "Content from cell 1",
956
+ ],
957
+ "id": "id",
958
+ "location": Object {
959
+ "end": Object {
960
+ "column": 22,
961
+ "line": 4,
962
+ "offset": 80,
963
+ },
964
+ "start": Object {
965
+ "column": 1,
966
+ "line": 4,
967
+ "offset": 59,
968
+ },
969
+ },
970
+ "margin": "",
971
+ "name": "table_cell",
972
+ "type": "block",
973
+ },
974
+ Object {
975
+ "content": Array [
976
+ "Content from cell 2",
977
+ ],
978
+ "id": "id",
979
+ "location": Object {
980
+ "end": Object {
981
+ "column": 42,
982
+ "line": 4,
983
+ "offset": 100,
984
+ },
985
+ "start": Object {
986
+ "column": 22,
987
+ "line": 4,
988
+ "offset": 80,
989
+ },
990
+ },
991
+ "margin": "",
992
+ "name": "table_cell",
993
+ "type": "block",
994
+ },
995
+ ],
996
+ "id": "id",
997
+ "location": Object {
998
+ "end": Object {
999
+ "column": 42,
1000
+ "line": 4,
1001
+ "offset": 100,
1002
+ },
1003
+ "start": Object {
1004
+ "column": 1,
1005
+ "line": 4,
1006
+ "offset": 59,
1007
+ },
1008
+ },
1009
+ "margin": "",
1010
+ "name": "table_row",
1011
+ "type": "block",
1012
+ },
1013
+ Object {
1014
+ "content": Array [
1015
+ Object {
1016
+ "content": Array [
1017
+ "Content in the first column",
1018
+ ],
1019
+ "id": "id",
1020
+ "location": Object {
1021
+ "end": Object {
1022
+ "column": 30,
1023
+ "line": 5,
1024
+ "offset": 130,
1025
+ },
1026
+ "start": Object {
1027
+ "column": 1,
1028
+ "line": 5,
1029
+ "offset": 101,
1030
+ },
1031
+ },
1032
+ "margin": "",
1033
+ "name": "table_cell",
1034
+ "type": "block",
1035
+ },
1036
+ Object {
1037
+ "content": Array [
1038
+ "Content in the second column",
1039
+ ],
1040
+ "id": "id",
1041
+ "location": Object {
1042
+ "end": Object {
1043
+ "column": 59,
1044
+ "line": 5,
1045
+ "offset": 159,
1046
+ },
1047
+ "start": Object {
1048
+ "column": 30,
1049
+ "line": 5,
1050
+ "offset": 130,
1051
+ },
1052
+ },
1053
+ "margin": "",
1054
+ "name": "table_cell",
1055
+ "type": "block",
1056
+ },
1057
+ ],
1058
+ "id": "id",
1059
+ "location": Object {
1060
+ "end": Object {
1061
+ "column": 59,
1062
+ "line": 5,
1063
+ "offset": 159,
1064
+ },
1065
+ "start": Object {
1066
+ "column": 1,
1067
+ "line": 5,
1068
+ "offset": 101,
1069
+ },
1070
+ },
1071
+ "margin": "",
1072
+ "name": "table_row",
1073
+ "type": "block",
1074
+ },
1075
+ ],
1076
+ "id": "id",
1077
+ "location": Object {
1078
+ "end": Object {
1079
+ "column": 59,
1080
+ "line": 5,
1081
+ "offset": 159,
1082
+ },
1083
+ "start": Object {
1084
+ "column": 1,
1085
+ "line": 2,
1086
+ "offset": 1,
1087
+ },
1088
+ },
1089
+ "margin": "",
1090
+ "name": "table",
1091
+ "type": "block",
1092
+ },
1093
+ ],
1094
+ "id": "id",
1095
+ "margin": "",
1096
+ "name": "root",
1097
+ "type": "block",
1098
+ }
1099
+ `);
1100
+ });
1101
+
1102
+ it("[markdown]: parse strikethrough", () => {
1103
+ const pod = `
1104
+ ~~this~~
1105
+ `;
1106
+ const tree = process(pod);
1107
+ const r = validateAstTree([tree]);
1108
+ expect(r).toEqual([]);
1109
+ const errorDescribe = isValidateError(r, tree);
1110
+ expect(process(pod)).toMatchInlineSnapshot(`
1111
+ Object {
1112
+ "content": Array [
1113
+ Object {
1114
+ "content": Array [
1115
+ Object {
1116
+ "content": Array [
1117
+ "this",
1118
+ ],
1119
+ "name": "Delete",
1120
+ "type": "fcode",
1121
+ },
1122
+ ],
1123
+ "id": "id",
1124
+ "location": Object {
1125
+ "end": Object {
1126
+ "column": 9,
1127
+ "line": 2,
1128
+ "offset": 9,
1129
+ },
1130
+ "start": Object {
1131
+ "column": 1,
1132
+ "line": 2,
1133
+ "offset": 1,
1134
+ },
1135
+ },
1136
+ "margin": "",
1137
+ "text": "text",
1138
+ "type": "para",
1139
+ },
1140
+ ],
1141
+ "id": "id",
1142
+ "margin": "",
1143
+ "name": "root",
1144
+ "type": "block",
1145
+ }
1146
+ `);
1147
+ });
1148
+ it("[markdown]: parse diagrams", () => {
1149
+ const pod = `
1150
+ \`\`\`mermaids caption="1"
1151
+ graph TD;
1152
+ A-->B;
1153
+ A-->C;
1154
+ B-->D;
1155
+ C-->D;
1156
+ \`\`\`
1157
+ `;
1158
+ const tree = process(pod);
1159
+ console.log(JSON.stringify(tree, null,2 ))
1160
+ })