suggestTitle static method

String suggestTitle(
  1. String content
)

Detect a suitable document title from the content

Implementation

static String suggestTitle(String content) {
  final headerMatch = RegExp(r'^#{1,3}\s+(.+)', multiLine: true).firstMatch(content);
  if (headerMatch != null) {
    return headerMatch.group(1)!.trim().replaceAll('**', '');
  }
  return 'Documento';
}