@@ -169,6 +169,15 @@ def test_latex_inline():
169169 assert output [1 ]['type' ] == notion .block .TextBlock
170170 assert output [1 ]['title' ] == r'Text before $$f(x) = \sigma(w \cdot x + b)$$ Text after'
171171
172+ def test_latex_inline_with_underscores ():
173+ '''it should render a latex block with underscores in it properly'''
174+ output = mistletoe .markdown (r'Text before $X^T=(X_1, X_2, \ldots, X_p)$ Text after' , addLatexExtension (NotionPyRenderer ))
175+
176+ assert len (output ) == 1
177+ output = output [0 ]
178+ assert output is not None
179+ assert output ['type' ] == notion .block .TextBlock
180+ assert output ['title' ] == r'Text before $$X^T=(X_1, X_2, \ldots, X_p)$$ Text after'
172181
173182def test_latex_block ():
174183 output = mistletoe .markdown (r"""
@@ -184,10 +193,20 @@ def test_latex_block():
184193
185194 assert output [2 ] is not None
186195 assert output [2 ]['type' ] == notion .block .EquationBlock
187- assert output [2 ]['title ' ] == 'f(x) = \\ \\ sigma(w \\ \\ cdot x + b)\n '
196+ assert output [2 ]['title_plaintext ' ] == 'f(x) = \\ \\ sigma(w \\ \\ cdot x + b)\n '
188197
189- def test_cli_latex_extension ():
190- pass
198+ def test_latex_block_with_underscores ():
199+ '''it should render a latex block with underscores in it properly'''
200+ output = mistletoe .markdown (r"""
201+ $$
202+ \hat{Y} = \hat{\beta}_0 + \sum_{j=1}^p X_j \hat{\beta}_j
203+ $$""" , addLatexExtension (NotionPyRenderer ))
204+
205+ assert len (output ) == 1
206+ output = output [0 ]
207+ assert output is not None
208+ assert output ['type' ] == notion .block .EquationBlock
209+ assert output ['title_plaintext' ] == '\\ \\ hat{Y} = \\ \\ hat{\\ \\ beta}_0 + \\ \\ sum_{j=1}^p X_j \\ \\ hat{\\ \\ beta}_j\n '
191210
192211def test_escapeSequence ():
193212 '''it should render out an escape sequence'''
0 commit comments