isContentYAML method
Identifies content
with YAML format.
Implementation
bool isContentYAML(String content) {
content = content
.replaceAll('\r', '\n')
.replaceAll(RegExp(r'(?:^|\n)[ \t]*#[^\n]*'), '\n');
content = content.replaceAll(RegExp(r'\n[ \t]*\n'), '\n\n');
content = content.replaceAll(RegExp(r'\n[ \t]*\n'), '\n\n');
content = content.replaceAll(RegExp(r'\n+'), '\n');
return RegExp(r'(?:^|\n)[ \t]*[\w.]+:').hasMatch(content);
}