code: func writeToFile(outputDir string, name string, data string) error {
  	outfileName := strings.Join([]string{outputDir, name}, string(filepath.Separator))
  
  	err := ensureDirectoryForFile(outfileName)
  	if err != nil {
  		return err
  	}
  
  	f, err := os.Create(outfileName)
  	if err != nil {
  		return err
  	}
  
  	defer f.Close()
  
  	_, err = f.WriteString(fmt.Sprintf("---\n# Source: %s\n%s", name, data))
  
  	if err != nil {
  		return err
  	}
  
  	fmt.Printf("wrote %s\n", outfileName)
  	return nil
  }
docs: // write the <data> to <output-dir>/<name>