Package selection guidance compiled from public package information, community data, and project usage.
gpt_markdown is a powerful Flutter package for rendering Markdown and LaTeX with rich text support, including math expressions, tables, links, and text selection. Designed for chat interfaces and AI-powered applications, it delivers high-fidelity formatting across Android, iOS, Web, macOS, Windows, and Linux. The package enhances user experience in apps like ChatGPT or Gemini by accurately displaying structured content with dynamic interactivity.
Use cases
AI chat interfaces
Documentation rendering
Mathematical content display
Interactive web-based notes
Cross-platform app content
Rich text messaging
Key features
Supports LaTeX math rendering
Full Markdown syntax compatibility
Text selection and copying
Responsive table layouts
Cross-platform consistency
High-performance rendering
Suitable for
Developers building AI chat apps
Educational platforms with math content
Technical documentation viewers
Content-rich mobile and web apps
Teams needing consistent Markdown output
Considerations
Requires careful handling of untrusted input
May need optimization for very large documents
LaTeX rendering depends on external dependencies
Limited customization for advanced styling
Best suited for static or semi-dynamic content
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
gpt_markdown
The Flutter renderer for AI output.
Production-grade Markdown and LaTeX rendering for streaming Flutter AI interfaces.
Render rich assistant replies, math, code, tables, citations, images, and custom inline UI in one widget.
Built for AI output — Markdown, LaTeX, code blocks, tables, citations, images, task lists, and mixed rich content in one response.
Streaming that stays fast — settled segments are reused while the live tail updates. At 12 KB, each update is 31× faster than in 1.2.1—or 74× faster with the lazy sliver. See the benchmarks.
Production-level control — style sheets, Flutter theme extensions, component builders, callbacks, and custom components.
Extensible inline UI — add @mentions, #channels, :emoji:, issue references, and product-specific syntax without forking the renderer.
Designed for real-world edge cases — RTL, text scaling, selection, malformed Markdown, autolinks, nested content, reduced motion, Flutter web, and WASM.
🧩 Everything AI output needs
Rendering
Production experience
Extensibility
📝
Rich Markdown
⚡
Adaptive streaming
🎨
Component style sheet
∑
Inline and block LaTeX
🚀
Lazy sliver rendering
🧱
Structural builders
💻
Syntax-highlighted code
♿
Selection and text scaling
🏷️
Mentions, channels, and emoji
📊
Tables and aligned columns
🌍
RTL, web, and WASM
🧩
Custom components and scopes
🔗
Links, autolinks, and images
🌓
Theme-aware rendering
👆
Interaction callbacks
☑️
Lists, tasks, and citations
🛡️
Graceful malformed input
📱
Custom URL schemes
🖼️ What it renders
Every image is one GptMarkdown widget with no styling applied — the defaults, in a dark theme. Click any of them for full size.
Rich text Headings, emphasis, lists, quotes, rules, autolinks.
LaTeX Inline and display equations, on the text baseline.
The reveal adapts to incoming text, finishes when generation ends, and respects reduced-motion settings. See the streaming guide for animation modes and configuration.
For long responses and documents, use SliverGptMarkdown inside a
CustomScrollView. It creates spans and widgets only for the segments requested
by the viewport, including its cache extent. The regular GptMarkdown widget is
cheaper for short content and remains the option for character reveal. See the
rendering architecture guide.
Use \( ... \) for inline LaTeX and \[ ... \] for block equations. Enable dollar-sign syntax with useDollarSignsForLatex: true. Code fences include syntax highlighting, language labels, and copy controls.
Wrap the renderer with SelectionArea when selectable output is needed:
SelectionArea(
child: GptMarkdown(reply),
)
🎨 Make it match your product
Use style objects for appearance and builders when you need to replace structure.
Set styles app-wide with GptMarkdownThemeData. Use builders such as codeBuilder, tableBuilder, and imageBuilder to replace components, or span-based builders for links, citations, and inline code. See customization.
🏷️ App-specific inline UI
Render mentions, channels, emoji, issue references, and other product syntax alongside Markdown:
Only known channel names are matched, longest-first. Patterns exclude link labels by default; unrecognized tokens such as #2959 remain text.
Use blockComponents for custom blocks and inlineDirectives for payloads the parser must leave untouched. See custom components.
Upgrading? Passing components or inlineComponents, even an empty list, selects the deprecated legacy parser. Replace them to use the new pipeline. See the migration guide and changelog.
🔗 Autolinks
Bare URLs, www. hosts, emails, and angle autolinks work automatically. Add custom schemes with autolinkSchemes: const {'myapp'}, or disable autolinking with autolink: false. Explicit [label](url) links still work. See inline syntax.