@@ -351,6 +351,11 @@ enum ISVBlockTypeId {
351351 * Text Drawing
352352 */
353353 TextDrawing = 'blk_631fefbbae02400430b8f9f4' ,
354+
355+ /**
356+ * Timeline
357+ */
358+ Timeline = 'blk_6358a421bca0001c22536e4c' ,
354359 /**
355360 * Other ISV block (type inference)
356361 */
@@ -392,7 +397,33 @@ interface TextDrawingBlock extends Block {
392397 }
393398}
394399
395- type ISVBlocks = TextDrawingBlock | OtherISVBlock
400+ interface Timeline {
401+ time : string
402+ title : string
403+ text ?: string
404+ }
405+
406+ interface TimelineBlock extends Block {
407+ type : BlockType . ISV
408+ snapshot : {
409+ type : BlockType . ISV
410+ /**
411+ * ISV block type id
412+ */
413+ block_type_id : ISVBlockTypeId . Timeline
414+ /**
415+ * ISV block data
416+ */
417+ data : {
418+ /**
419+ * Mermaid code
420+ */
421+ items : Timeline [ ]
422+ }
423+ }
424+ }
425+
426+ type ISVBlocks = TextDrawingBlock | TimelineBlock | OtherISVBlock
396427
397428interface NotSupportedBlock extends Block {
398429 type :
@@ -870,7 +901,7 @@ type Mutate<T extends Block> = T extends PageBlock
870901 ? mdast . Link
871902 : T extends IframeBlock
872903 ? mdast . Html
873- : T extends TextDrawingBlock
904+ : T extends TextDrawingBlock | TimelineBlock
874905 ? mdast . Code
875906 : null
876907
@@ -1427,6 +1458,14 @@ export class Transformer {
14271458 value : block . snapshot . data . data ,
14281459 }
14291460
1461+ return code
1462+ } else if ( block . snapshot . block_type_id === ISVBlockTypeId . Timeline ) {
1463+ const code : mdast . Code = {
1464+ type : 'code' ,
1465+ lang : 'mermaid' ,
1466+ value : this . generateMermaidTimeline ( block . snapshot . data . items ) ,
1467+ }
1468+
14301469 return code
14311470 }
14321471
@@ -1437,6 +1476,24 @@ export class Transformer {
14371476 }
14381477 }
14391478
1479+ generateMermaidTimeline ( items : Timeline [ ] ) : string {
1480+ let chart = 'timeline\n'
1481+
1482+ items . forEach ( item => {
1483+ const cleanTitle = ( item . title || '' ) . replace ( / : / g, ':' )
1484+ const time = item . time || ''
1485+
1486+ if ( item . text ) {
1487+ const cleanText = item . text . replace ( / \n / g, '<br>' )
1488+ chart += ` ${ time } : ${ cleanTitle } : ${ cleanText } \n`
1489+ } else {
1490+ chart += ` ${ time } : ${ cleanTitle } \n`
1491+ }
1492+ } )
1493+
1494+ return chart
1495+ }
1496+
14401497 transform < T extends Blocks > ( block : T ) : TransformResult < Mutate < T > > {
14411498 const node = this . _transform ( block ) as Mutate < T >
14421499
0 commit comments