コード例 #1
0
def test_latex_inline():
    output = mistletoe.markdown(r"""
# Test for latex blocks
Text before $f(x) = \sigma(w \cdot x + b)$ Text after
""", addLatexExtension(NotionPyRenderer))

    assert output[1] is not None
    assert output[1]['type'] == notion.block.TextBlock
    assert output[1]['title'] == r'Text before $$f(x) = \sigma(w \cdot x + b)$$ Text after'
コード例 #2
0
def test_latex_block_with_underscores():
    '''it should render a latex block with underscores in it properly'''
    output = mistletoe.markdown(r"""
$$
\hat{Y} = \hat{\beta}_0 + \sum_{j=1}^p X_j \hat{\beta}_j
$$""", addLatexExtension(NotionPyRenderer))

    assert len(output) == 1
    output = output[0]
    assert output is not None
    assert output['type'] == notion.block.EquationBlock
    assert output['title_plaintext'] == '\\\\hat{Y} = \\\\hat{\\\\beta}_0 + \\\\sum_{j=1}^p X_j \\\\hat{\\\\beta}_j\n'
コード例 #3
0
def test_latex_block():
    output = mistletoe.markdown(r"""
# Test for latex blocks
Text before

$$
f(x) = \sigma(w \cdot x + b)
$$

Text after
""", addLatexExtension(NotionPyRenderer))

    assert output[2] is not None
    assert output[2]['type'] == notion.block.EquationBlock
    assert output[2]['title'] == 'f(x) = \\\\sigma(w \\\\cdot x + b)\n'
コード例 #4
0
def test_latex_inline_with_underscores():
    '''it should render a latex block with underscores in it properly'''
    output = mistletoe.markdown(r'Text before $X^T=(X_1, X_2, \ldots, X_p)$ Text after', addLatexExtension(NotionPyRenderer))

    assert len(output) == 1
    output = output[0]
    assert output is not None
    assert output['type'] == notion.block.TextBlock
    assert output['title'] == r'Text before $$X^T=(X_1, X_2, \ldots, X_p)$$ Text after'