@@ -7,6 +7,11 @@ const ifTrue = (predicate, transformer, orElse) => (data) =>
77
88const id = ( x ) => x
99
10+ const annotateEquation = ifTrue (
11+ pick ( "equation" ) ,
12+ ( { content } ) => ( { content : `$${ content } $` } ) ,
13+ id ,
14+ )
1015const annotateBold = ifTrue ( pick ( "bold" ) , ( { content } ) => ( { content : `**${ content } **` } ) , id )
1116const annotateItalic = ifTrue ( pick ( "italic" ) , ( { content } ) => ( { content : `_${ content } _` } ) , id )
1217const annotateCode = ifTrue ( pick ( "code" ) , ( { content } ) => ( { content : `\`${ content } \`` } ) , id )
@@ -38,6 +43,7 @@ const stylize = pipeExtend(annotateBold)
3843 . pipeExtend ( annotateUnderline )
3944 . pipeExtend ( annotateColor )
4045 . pipeExtend ( annotateLink )
46+ . pipeExtend ( annotateEquation )
4147
4248exports . blockToString = ( textBlocks ) =>
4349 textBlocks . reduce ( ( text , textBlock ) => {
@@ -46,6 +52,11 @@ exports.blockToString = (textBlocks) =>
4652 ...textBlock . annotations ,
4753 }
4854
55+ if ( textBlock . type == "equation" ) {
56+ data . content = textBlock . equation . expression
57+ data . equation = true
58+ }
59+
4960 if ( textBlock . type == "mention" ) {
5061 if ( textBlock . mention . type == "user" ) {
5162 data . content = textBlock . plain_text
0 commit comments