Private
Public Access
0
0

fix(md_renderer_py): remove push_font for headings (API mismatch)

The imgui_bundle imgui.push_font() signature is:
  push_font(font: ImFont | None, font_size_base_unscaled: float) -> None

We were calling it with one arg (the font). This crashed imgui at
runtime, leaving imscope in a broken state and cascading to
subsequent scope errors (Missing EndGroup, PopID too many times,
Size > 0).

Since we don't have a separate heading font configured, just skip
the font push for headings. Headings render at the default font size
and use a separator (for h1/h2) to look distinct. User can subclass
MarkdownRenderer and override _handle_heading_open to add a custom
font later.

REMOVED: _get_heading_font method (no longer needed)
This commit is contained in:
Conductor
2026-06-03 22:55:14 -04:00
parent c434ec93eb
commit 3117061be5
2 changed files with 1 additions and 11 deletions
+1 -3
View File
@@ -61,9 +61,7 @@ def test_renderer_renders_h1_with_separator():
with patch("src.md_renderer_py.imgui") as mock_imgui:
_mock_imgui(mock_imgui)
r.render("# Heading 1")
assert mock_imgui.push_font.called
assert mock_imgui.pop_font.called
assert mock_imgui.separator.called
assert mock_imgui.separator.called, "h1/h2 should render a separator after the heading"
def test_renderer_renders_bullet_list_with_bullets():
r = MarkdownRenderer()