Private
Public Access
0
0

fix(markdown): restore options attr on MarkdownRenderer for immapp.AddOnsParams

The C++ imgui_md.MarkdownOptions is still needed by
immapp.AddOnsParams(with_markdown_options=...) which is passed to
immapp.run() in src/gui_2.py:430. The Python port in src/md_renderer_py
is for OUR renderer; the immapp markdown viewer is a separate thing
that uses the C++ library internally.

Both are wired:
  - self.options: C++ imgui_md.MarkdownOptions for immapp.AddOnsParams
  - self._py_renderer: Python port for our body content rendering
  - Both share the on_open_link callback (webbrowser.open / IDE)

This fix unblocks 'uv run sloppy.py' which was crashing on
  'MarkdownRenderer' object has no attribute 'options'
This commit is contained in:
Conductor
2026-06-03 22:47:08 -04:00
parent fe618055ca
commit c434ec93eb
+5
View File
@@ -62,6 +62,11 @@ class MarkdownRenderer:
ImGuiColorTextEdit for syntax-highlighted code blocks.
"""
def __init__(self):
self.options = imgui_md.MarkdownOptions()
self.options.font_options.font_base_path = "fonts/Inter"
self.options.font_options.regular_size = 18.0
self.options.callbacks.on_open_link = self._on_open_link
self._py_renderer = PyMarkdownRenderer()
self._py_renderer.options.callbacks.on_open_link = self._on_open_link
self._py_renderer.set_external_code_block_handler(self._on_code_block)