Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 FIX: Regression in dollarmath #69

Merged
merged 2 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mdit_py_plugins/dollarmath/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
5 changes: 5 additions & 0 deletions tests/test_dollarmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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() == '<p><span class="math inline">x</span></p>'


@pytest.mark.parametrize(
"line,title,input,expected",
read_fixture_file(FIXTURE_PATH.joinpath("dollar_math.md")),
Expand Down