@@ -7,6 +7,11 @@ const ifTrue = (predicate, transformer, orElse) => (data) =>
7
7
8
8
const id = ( x ) => x
9
9
10
+ const annotateEquation = ifTrue (
11
+ pick ( "equation" ) ,
12
+ ( { content } ) => ( { content : `$${ content } $` } ) ,
13
+ id ,
14
+ )
10
15
const annotateBold = ifTrue ( pick ( "bold" ) , ( { content } ) => ( { content : `**${ content } **` } ) , id )
11
16
const annotateItalic = ifTrue ( pick ( "italic" ) , ( { content } ) => ( { content : `_${ content } _` } ) , id )
12
17
const annotateCode = ifTrue ( pick ( "code" ) , ( { content } ) => ( { content : `\`${ content } \`` } ) , id )
@@ -38,6 +43,7 @@ const stylize = pipeExtend(annotateBold)
38
43
. pipeExtend ( annotateUnderline )
39
44
. pipeExtend ( annotateColor )
40
45
. pipeExtend ( annotateLink )
46
+ . pipeExtend ( annotateEquation )
41
47
42
48
exports . blockToString = ( textBlocks ) =>
43
49
textBlocks . reduce ( ( text , textBlock ) => {
@@ -46,6 +52,11 @@ exports.blockToString = (textBlocks) =>
46
52
...textBlock . annotations ,
47
53
}
48
54
55
+ if ( textBlock . type == "equation" ) {
56
+ data . content = textBlock . equation . expression
57
+ data . equation = true
58
+ }
59
+
49
60
if ( textBlock . type == "mention" ) {
50
61
if ( textBlock . mention . type == "user" ) {
51
62
data . content = textBlock . plain_text
0 commit comments