processFile function

Future<void> processFile(
  1. FileSystemEntity f,
  2. String outputPath,
  3. String includesPath,
  4. String templatesPath,
)

Implementation

Future<void> processFile(final FileSystemEntity f, final String outputPath,
    final String includesPath, String templatesPath) async {
  final name = p.basename(f.path);
  print("found input file: $name");
  if (p.extension(f.path).toLowerCase() == '.md') {
    print("processing: $name");
    final markdown = (f as File).readAsStringSync();
    final title = p.basenameWithoutExtension(f.path);
    final html = await processMarkdown(
      markdown,
      title,
      includesPath,
      templatesPath,
    );

    final outputFile = File(p.join(outputPath, "$title.html"));
    outputFile.writeAsStringSync(html);
    print("wrote output to: $outputPath");
  }
}