front_matter 1.1.0 copy "front_matter: ^1.1.0" to clipboard
front_matter: ^1.1.0 copied to clipboard

A front matter parser that extracts YAML metadata from the start of a file or string.

example/front_matter.dart

import 'dart:io';
import 'package:front_matter/front_matter.dart' as fm;

// Example 1 - Parse a string.
void example1() async {
  var file = File('example/hello-world.md');
  var fileContents = await file.readAsString();

  var doc = fm.parse(fileContents);

  print("The author is ${doc.data['author']}");
  print("The publish date is ${doc.data['date']}");
  print("The content is ${doc.content}");
}

// Example 2 - Read a file and parse its contents.
void example2() async {
  var doc = await fm.parseFile('example/hello-world.md');

  print("The author is ${doc.data['author']}");
  print("The publish date is ${doc.data['date']}");
  print("The content is ${doc.content}");
}

void main() async {
  await example1();
  await example2();
}
3
likes
40
pub points
15%
popularity

Publisher

unverified uploader

A front matter parser that extracts YAML metadata from the start of a file or string.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

MIT (license)

Dependencies

yaml

More

Packages that depend on front_matter