Markdown Features

Every construct supported by GptMarkdown v1.2.1 — what the syntax looks like, what it renders, and what the limits are.

Supported constructs

SyntaxNotes
# H1 … ###### H6Six heading levels. H1 draws a rule by default.
**bold** / *italic*Standard emphasis. ***both*** also works.
~~strikethrough~~GFM strikethrough.
<u>underline</u>HTML underline tag.
`inline code`Monospace chip, baseline-aligned, selectable.
```fenced```Code block with language label. closed flag available.
- / 1.Unordered and ordered lists, nested.
- [x] / - [ ]Task-list checkboxes. Interactive via CheckboxStyle.
(x) / ( )Radio options. Same style class as checkboxes.
| col | col |Pipe tables with :--- alignment.
> quoteBlock quotes. Bar, background, builder.
---Horizontal rule. Thickness and colour via HrStyle.
[label](url)Links. onLinkTap, linkBuilder, LinkStyle.
bare URL / www.GFM autolinks. autolink: false disables.
<url>CommonMark §6.5 autolinks. Any scheme.
![alt](url)Images. imageBuilder, ImageStyle, onImageTap.
\\( \\) / \\[ \\]LaTeX inline and block. Default renderer included; replace with latexBuilder if needed.
$…$ / $$…$$Dollar-sign LaTeX. Opt in with useDollarSignsForLatex.
[1]Citation chip. onSourceTagTap, SourceTagStyle.
==highlighted==Background highlight spans.

Realistic AI response

A typical LLM response mixes prose, LaTeX, a code fence, a table, task list, blockquote, and a citation:

ai_response_example.dart
1# Summary 2 3The Pythagorean theorem states that for a right triangle: 4 5\\[ a^2 + b^2 = c^2 \\] 6 7Here is a quick implementation in Dart: 8 9```dart 10double hypotenuse(double a, double b) => sqrt(a * a + b * b); 11``` 12 13## Comparison 14 15| Approach | Lines | Readable | 16|:---------------|:-----:|:--------:| 17| Direct formula | 1 || 18| Loop | 5 || 19 20## Tasks 21 22- [x] Write the function 23- [ ] Add unit tests 24- [ ] Benchmark 25 26> The formula is exact for integers as well — Pythagorean triples like 3, 4, 5 27> have been known since antiquity. 28 29Source: [Wikipedia](https://en.wikipedia.org/wiki/Pythagorean_theorem) [1]

Autolinks

Bare URLs, www. hosts, and email addresses are linked automatically following the GFM autolink extension. <…> autolinks follow CommonMark §6.5 and accept any scheme. Autolinks are on by default — disable with autolink: false for untrusted input.

autolinks.dart
1// Autolinks are ON by default. 2// Bare URLs, www. hosts, and email addresses become tappable links. 3GptMarkdown( 4 'Visit https://flutter.dev or email hello@example.com', 5 onLinkTap: (url, title) => launchUrlString(url), 6) 7 8// Disable for untrusted input where accidental tap targets are unwelcome. 9GptMarkdown(content, autolink: false) 10 11// Add custom schemes that should link without angle brackets. 12// http, https, mailto and xmpp are always linked. 13GptMarkdown( 14 'Open myapp://dashboard', 15 autolinkSchemes: const {'myapp'}, 16 onLinkTap: (url, title) => handleDeepLink(url), 17)

Citations

Numeric citation references like [1] render as tappable chips. Style them with SourceTagStyle and handle taps with onSourceTagTap.

citations.dart
1// [1] citation chips are rendered inline and tappable. 2GptMarkdown( 3 'The Riemann hypothesis [1] remains unproven.', 4 onSourceTagTap: (content) { 5 // content = "1" 6 showSource(content); 7 }, 8)

Tables

GFM-style pipe tables with column alignment (:---, ---:, :---:). Tables scroll horizontally on narrow screens.

tables.dart
1GptMarkdown(r''' 2| Name | Score | Grade | 3|:--------|------:|:-----:| 4| Alice | 95 | A | 5| Bob | 82 | B | 6| Charlie | 74 | C | 7''')

Task lists and radio options

Task-list checkboxes render the source state and are read-only by default. Enable interactivity with CheckboxStyle(interactive: true) and handle changes via onCheckboxChanged. Radio options use the same style class.

tasks_radio.dart
1// Task lists — checkboxes are read-only unless you opt in. 2GptMarkdown( 3 ''' 4- [x] Install gpt_markdown 5- [ ] Customize the math widget (optional) 6- [ ] Deploy 7 ''', 8 // Optional: make checkboxes interactive. 9 styleSheet: const GptMarkdownStyleSheet( 10 checkbox: CheckboxStyle(interactive: true), 11 ), 12 onCheckboxChanged: (value) => persistCheckbox(value), 13) 14 15// Radio options — same style class as checkboxes. 16GptMarkdown(''' 17Which approach do you prefer? 18- (x) Direct formula 19- ( ) Loop 20- ( ) Recursive 21''')

Images

Standard ![alt](url) syntax. Dimensions can be encoded in the alt text as WxH. Override with imageBuilder for custom caching, borders, or lightboxes.

images.dart
1// Basic image 2GptMarkdown('![Flutter logo](https://flutter.dev/images/logo.png)') 3 4// With explicit dimensions (alt parsed as WxH) 5GptMarkdown('![100x80](https://example.com/icon.png)') 6 7// Custom renderer — receives url, width, height (null if not specified) 8GptMarkdown( 9 content, 10 imageBuilder: (context, url, width, height) { 11 return ClipRRect( 12 borderRadius: BorderRadius.circular(8), 13 child: Image.network(url, width: width, height: height), 14 ); 15 }, 16 onImageTap: (url) => openLightbox(url), 17)

Scope and limitations

Designed for AI output. The parser is tuned for what LLMs emit, not for full CommonMark conformance. Edge cases in deeply nested or pathological Markdown may not round-trip correctly.

Selection across blocks. Copying across a list or table yields the cells run together with no separators — block content is rendered as inline widgets. Prose, headings, links, and inline code copy correctly.

LaTeX needs a renderer. The package parses \( \) and \[ \] delimiters and renders them with the included default renderer. Pass a latexBuilder only to replace it — see LaTeX Support.

No raw HTML pass-through. Only the <u> tag is handled. Arbitrary HTML is rendered as text.