Files
pipelines/app/tool/chat_markdown_probe.dart
T
alan a5afc55a9d feat(app): render native transcript markdown
Port the web markdown subset to a pure Dart parser and a native
Material/Cupertino block renderer, with a caller seam for assistant text
parts and safe http(s) link activation.

- parser: entities, paragraphs, H1-H6, fenced code, quotes, lists, tables,
  rules, inline code/emphasis/links; entity overflow stays literal
- renderer: host text roles, inline/fenced code fills, table header fill,
  heading level and list/columnHeader semantics, horizontal code/table
  scrolling, native selection
- tests cover parser safety, both hosts, the seam and real taps
- probe plus note record the web evidence and remaining limits
2026-10-21 23:34:33 +01:00

64 lines
1.5 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pipelines_app/features/chat/ui/transcript/chat_markdown_view.dart';
const _style = String.fromEnvironment(
'CHAT_MARKDOWN_PROBE_STYLE',
defaultValue: 'material',
);
const _sample = '''
# Heading one
## Heading two
### Heading three
#### Heading four
##### Heading five
###### Heading six
A paragraph with **bold**, *italic*, `inline code`, and snake_case_name staying plain.
> quoted line one
> quoted line two
- bullet one
- bullet two
1. first item
2. second item
| Name | Value |
| --- | --- |
| alpha | 1 |
| beta | 2 |
```dart
const answer = 42;
keep spaces
```
---
[Open docs](https://example.com/docs) and [unsafe](javascript:alert) stay safe.
Bare https://example.com/auto link.
<b>literal html</b> and ~~strikethrough~~ stay text.
''';
/// One assistant markdown sample for the Material and Cupertino dark captures.
void main() {
final content = ListView(
padding: const EdgeInsets.all(16),
children: const [ChatMarkdownView(text: _sample)],
);
if (_style == 'cupertino') {
runApp(
CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.dark),
home: CupertinoPageScaffold(child: SafeArea(child: content)),
),
);
return;
}
runApp(
MaterialApp(
theme: ThemeData(
brightness: Brightness.dark,
platform: TargetPlatform.android,
),
home: Scaffold(body: SafeArea(child: content)),
),
);
}