Skip to content

Commit de7f783

Browse files
authored
πŸ› FIX: Regression in dollarmath (#69)
1 parent 19de2ff commit de7f783

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

β€Žmdit_py_plugins/dollarmath/index.pyβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ def dollarmath_plugin(
5454
# would be good to allow "proper" math rendering,
5555
# e.g. https://github.com/roniemartinez/latex2mathml
5656

57-
_renderer = lambda content, _: escapeHtml(content) if renderer is None else renderer
57+
_renderer = (
58+
(lambda content, _: escapeHtml(content)) if renderer is None else renderer
59+
)
5860

5961
if label_renderer is None:
6062
_label_renderer = (

β€Žtests/test_dollarmath.pyβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ def test_plugin_parse(data_regression):
8181
data_regression.check([t.as_dict() for t in tokens])
8282

8383

84+
def test_custom_renderer(data_regression):
85+
md = MarkdownIt().use(dollarmath_plugin, renderer=lambda x, y: x)
86+
assert md.render("$x$").strip() == '<p><span class="math inline">x</span></p>'
87+
88+
8489
@pytest.mark.parametrize(
8590
"line,title,input,expected",
8691
read_fixture_file(FIXTURE_PATH.joinpath("dollar_math.md")),

0 commit comments

Comments
Β (0)