diff --git a/mdit_py_plugins/dollarmath/index.py b/mdit_py_plugins/dollarmath/index.py index 9c531da..2663617 100644 --- a/mdit_py_plugins/dollarmath/index.py +++ b/mdit_py_plugins/dollarmath/index.py @@ -54,7 +54,9 @@ def dollarmath_plugin( # would be good to allow "proper" math rendering, # e.g. https://github.com/roniemartinez/latex2mathml - _renderer = lambda content, _: escapeHtml(content) if renderer is None else renderer + _renderer = ( + (lambda content, _: escapeHtml(content)) if renderer is None else renderer + ) if label_renderer is None: _label_renderer = ( diff --git a/tests/test_dollarmath.py b/tests/test_dollarmath.py index d10d724..62f52ef 100644 --- a/tests/test_dollarmath.py +++ b/tests/test_dollarmath.py @@ -81,6 +81,11 @@ def test_plugin_parse(data_regression): data_regression.check([t.as_dict() for t in tokens]) +def test_custom_renderer(data_regression): + md = MarkdownIt().use(dollarmath_plugin, renderer=lambda x, y: x) + assert md.render("$x$").strip() == '
x
' + + @pytest.mark.parametrize( "line,title,input,expected", read_fixture_file(FIXTURE_PATH.joinpath("dollar_math.md")),