Style & Parameters
Complete reference for every parameter on the GptMarkdown widget.
Full signature
reference.dart
1GptMarkdown(
2 'your markdown string', // required, positional
3
4 // Text
5 style: TextStyle(...), // base text style
6 textDirection: TextDirection.ltr, // LTR (default) or RTL
7 textAlign: TextAlign.start, // text alignment
8 textScaler: TextScaler.linear(1), // text scaling
9 maxLines: null, // max lines (null = unlimited)
10 overflow: TextOverflow.clip, // overflow behaviour
11
12 // Links
13 onLinkTap: (url, title) { }, // handle link taps
14 followLinkColor: false, // inherit link color from style
15 linkBuilder: (ctx, text, href, title) => Widget,
16
17 // LaTeX
18 useDollarSignsForLatex: false, // enable $...$ and $$...$$ syntax
19 latexWorkaround: (tex) => tex, // normalize AI output quirks
20 latexBuilder: (ctx, latex, style, inline) => Widget,
21
22 // Code blocks
23 codeBuilder: (ctx, lang, code, closed) => Widget,
24
25 // Inline code / highlight
26 highlightBuilder: (ctx, code, style) => Widget,
27
28 // Images
29 imageBuilder: (ctx, url, alt) => Widget,
30
31 // Lists
32 orderedListBuilder: (ctx, num, style) => Widget,
33 unOrderedListBuilder: (ctx, depth, style) => Widget,
34
35 // Tables
36 tableBuilder: (ctx, headers, rows) => Widget,
37
38 // Source tags (citations)
39 sourceTagBuilder: (ctx, sources) => Widget,
40
41 // Custom block-level components
42 components: [...],
43
44 // Custom inline components
45 inlineComponents: [...],
46)Parameter reference
| Parameter | Type | Req. | Description |
|---|---|---|---|
| data | String | ✅ | The Markdown string to render. Positional argument. |
| style | TextStyle? | Base text style applied to all text. | |
| textDirection | TextDirection | LTR (default) or RTL — for Arabic, Hebrew, etc. | |
| textAlign | TextAlign? | Text alignment within the widget. | |
| textScaler | TextScaler? | Scales text size uniformly. | |
| maxLines | int? | Limits number of rendered lines. | |
| overflow | TextOverflow? | Overflow behaviour when maxLines is set. | |
| followLinkColor | bool | If true, links inherit the base text color. | |
| onLinkTap | Function(url, title)? | Callback when a Markdown link is tapped. | |
| linkBuilder | LinkBuilder? | Fully replace the link widget. | |
| useDollarSignsForLatex | bool | Enable $...$ and $$...$$ LaTeX delimiters. | |
| latexWorkaround | Function(String)? | Transform LaTeX strings before rendering (e.g. unescape). | |
| latexBuilder | LatexBuilder? | Replace the LaTeX renderer with your own widget. | |
| codeBuilder | CodeBlockBuilder? | Replace the code block renderer. | |
| highlightBuilder | HighlightBuilder? | Replace inline code (backtick) renderer. | |
| imageBuilder | ImageBuilder? | Replace the image renderer. | |
| orderedListBuilder | OrderedListBuilder? | Replace the ordered list item renderer. | |
| unOrderedListBuilder | UnOrderedListBuilder? | Replace the unordered list item renderer. | |
| tableBuilder | Function? | Replace the table renderer. | |
| sourceTagBuilder | SourceTagBuilder? | Render citation/source tags. | |
| components | List? | Custom block-level Markdown components. | |
| inlineComponents | List? | Custom inline Markdown components. |