Skip to content

fix: inline double dollar to be rendered with class math block #124

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion mdit_py_plugins/dollarmath/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def render_math_inline_double(
env: EnvType,
) -> str:
content = _renderer(str(tokens[idx].content).strip(), {"display_mode": True})
return f'<div class="math inline">{content}</div>'
return f'<div class="math block">{content}</div>'

def render_math_block(
self: RendererProtocol,
Expand Down
8 changes: 4 additions & 4 deletions tests/fixtures/dollar_math.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,21 +516,21 @@ Inline double-dollar start:
.
$$a=1$$ b
.
<p><div class="math inline">a=1</div> b</p>
<p><div class="math block">a=1</div> b</p>
.

Inline double-dollar end:
.
a $$a=1$$
.
<p>a <div class="math inline">a=1</div></p>
<p>a <div class="math block">a=1</div></p>
.

Inline double-dollar enclosed:
.
a $$a=1$$ (1) b
.
<p>a <div class="math inline">a=1</div> (1) b</p>
<p>a <div class="math block">a=1</div> (1) b</p>
.

Inline double-dollar, escaped:
Expand All @@ -549,7 +549,7 @@ $$
i.e., $[\alpha \bar{X}, \infty)$ is a lower 1-sided $1-\alpha$ confidence bound for $\mu$.
.
<p>Hence, for <span class="math inline">\alpha \in (0, 1)</span>,
<div class="math inline">\mathbb P (\alpha \bar{X} \ge \mu) \le \alpha;</div>
<div class="math block">\mathbb P (\alpha \bar{X} \ge \mu) \le \alpha;</div>
i.e., <span class="math inline">[\alpha \bar{X}, \infty)</span> is a lower 1-sided <span class="math inline">1-\alpha</span> confidence bound for <span class="math inline">\mu</span>.</p>
.

Expand Down