Dear ImGui Bundle includes libraries for syntax-highlighted text editing and markdown rendering.
imgui_md - Markdown Rendering¶
Introduction¶
imgui_md renders markdown content directly in your ImGui interface. Supports headers, bold, italic, links, code blocks, lists, and more.
Quick example:
from imgui_bundle import imgui_md, immapp
def gui():
imgui_md.render("""
# Hello Markdown
This is **bold** and this is *italic*.
- List item 1
- List item 2
""")
immapp.run(gui, with_markdown=True)You may also use imgui_md.render_unindented(s) – it removes the leading indentation of the markdown string before rendering, which is useful when the string is defined inside a function with indentation.
#include "immapp/immapp.h"
#include "imgui_md_wrapper/imgui_md_wrapper.h"
void gui() {
ImGuiMd::Render(R"(
# Hello Markdown
This is **bold** and this is *italic*.
- List item 1
- List item 2
)");
}
int main() {
ImmApp::RunWithMarkdown(gui);
return 0;
}Images¶
imgui_md supports images from local assets and from URLs.
Standard markdown images:

HTML img tags with explicit size:
<img src="https://example.com/photo.jpg" width="200">
<img src="images/logo.png" width="100" height="50">LaTeX math¶
imgui_md can render inline and display LaTeX math via the bundled imgui_microtex library — a thin wrapper around MicroTeX.
Quick example:
from imgui_bundle import imgui_md, immapp
def gui():
imgui_md.render_unindented(r"""
# Math in markdown
Inline math sits on the text baseline: $E = mc^2$, $\sqrt{a^2 + b^2}$,
$\sum_{i=0}^{n} i = \frac{n(n+1)}{2}$.
Display math is centered on its own line:
$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
Sums, integrals, matrices all work:
$$
\int_{-\infty}^{\infty} e^{-x^2}\, dx = \sqrt{\pi}
\qquad
A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}
\qquad
e^{i\pi} + 1 = 0
$$
""")
immapp.run(gui, with_latex=True) # implies with_markdown=TrueNote the raw string (r"""..."""): without it, Python would interpret sequences like \theta as escape characters and silently corrupt the LaTeX.
#include "immapp/immapp.h"
#include "imgui_md_wrapper/imgui_md_wrapper.h"
void gui() {
ImGuiMd::Render(R"(
# Math in markdown
Inline math: $E = mc^2$, $\sqrt{a^2 + b^2}$.
$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
)");
}
int main() {
ImmApp::AddOnsParams addons;
addons.withLatex = true; // implies withMarkdown=true
HelloImGui::SimpleRunnerParams simple;
simple.guiFunction = gui;
ImmApp::Run(simple, addons);
return 0;
}Full Demo¶
Try online | Python | C++
Documented APIs¶
Python: imgui_md.pyi
C++: imgui_md_wrapper.h
ImGuiColorTextEdit - Syntax Highlighting Editor & Diff Viewer¶
Introduction¶
ImGuiColorTextEdit is a syntax highlighting text editor and diff viewer for ImGui (originally by BalazsJako, rewritten from scratch by Johan A. Goossens).
Dear ImGui Bundle uses a fork with a few additions for Python bindings.
Features:
Syntax highlighting for C, C++, Python, GLSL, HLSL, Lua, SQL, AngelScript, C#, JSON, Markdown
Multiple color palettes (dark, light)
Find/replace UI with keyboard shortcuts
Text markers (colored line highlights with tooltips)
Bracket matching with visual indicators
Line decorators (custom gutter content per line, e.g. breakpoints)
Context menu callbacks (separate for line numbers and text area)
Change and transaction callbacks
Filter selections/lines (transform text via callbacks)
Autocomplete framework
Undo/redo, copy/paste, multi-cursor support
TextDiff widget: combined and side-by-side diff view for comparing two texts
Full Demo¶
Try online | Python | C++
Documented APIs¶
Python: imgui
_color _text _edit .pyi C++: TextEditor.h | TextDiff.h