slideMarkdownParser function

List<SlideData> slideMarkdownParser(
  1. String text
)

Extracts and parses YAML front matter from a String.

Returns a SlideData comprising the parsed YAML front matter data YamlMap, and the remaining content String.

Throws a FrontMatterException if front matter contains invalid YAML.

Implementation

List<SlideData> slideMarkdownParser(String text) {
  // Remove any leading whitespace.
  final value = text.trimLeft();

  // If there's no starting delimiter, there's no front matter.
  if (!value.startsWith(delimiter)) {
    // throw const FrontMatterException(frontMatterRequired);
    return [];
  }
  return findNextFrontMatterSlide(value, firstRun: true);
}