fe618055ca
ADD src/md_renderer_py.py: Full port of mekhontsev/imgui_md to pure Python.
- Uses markdown-it-py (already a transitive dep) for AST parsing.
- Walks the token tree, calling imgui primitives directly.
- Mirrors the C++ API surface: MarkdownOptions, MarkdownCallbacks,
MarkdownRenderer.render(), render_unindented().
- Code blocks delegated via set_external_code_block_handler callback.
- All other content (paragraphs, headings, lists, code, tables, hr,
emphasis, strong, links, blockquotes) rendered natively.
ROOT CAUSE OF BULLET OVERLAP (now fixed at the source):
imgui-md C++ BLOCK_P guards NewLine() behind 'if (!m_list_stack.empty())'
(imgui_md.cpp line ~145). Inside lists, paragraph transitions don't
advance the cursor Y. The Python port calls imgui.new_line() explicitly
between paragraphs in a list item, eliminating the overlap.
ROOT CAUSE OF '*' BULLET Y-OVERLAP (now fixed at the source):
imgui-md C++ BLOCK_LI for '*' delim calls ImGui::Bullet() without
ImGui::SameLine() (imgui_md.cpp line ~95). The Python port calls
imgui.bullet() + imgui.same_line() for all markers uniformly.
REMOVED in src/markdown_helper.py:
- _normalize_bullet_delimiters (no longer needed)
- _normalize_nested_list_endings (no longer needed)
- _normalize_list_continuations (no longer needed)
- parse_tables / render_table (renderer handles tables natively)
- All 'imgui_md' body rendering (replaced by Python port)
TESTS:
- tests/test_md_renderer_py.py (new): 16 unit tests for the Python port
covering paragraphs, headings, lists, nested lists, emphasis, strong,
code, links, tables, hr, unindented.
- tests/test_markdown_helper_bullets.py (rewritten): 13 tests for the
integration with the public MarkdownRenderer class.
- tests/test_markdown_render_robust.py (updated): 2 tests verifying
table content is routed through the new Python renderer (not imgui_md).
- tests/test_markdown_table.py / _render.py / _columns.py / _wrapped.py:
unchanged (test the standalone render_table which is still used by
the new renderer as a fallback for any unhandled cases).
42/42 markdown tests pass. 1-space indentation. 1 C++ dependency
removed (imgui_md is no longer used at runtime).
NOT FIXED (known limitations of the new renderer):
- Inline code rendering uses a tinted small_button (not monospace)
- Heading fonts use the default font (no separate bold/large fonts)
- Image rendering shows a placeholder text
- These can be improved by subclassing MarkdownRenderer