extractFirstCodeBlock function
Returns first fenced code block content or null.
Implementation
String? extractFirstCodeBlock(String markdown) {
final RegExp re = RegExp(r'```[\w]*\n([\s\S]*?)```');
final Match? m = re.firstMatch(markdown);
return m?.group(1)?.trim();
}