code: func (e *Engine) LoadDirectory(dir string, extension string) error {
  	e.mu.Lock()
  	defer e.mu.Unlock()
  	var templateErr error
  	// Walk the supplied directory and compile any files that match our extension list.
  	filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
  
  		if info == nil || info.IsDir() {
  
  		} else {
  
  			rel, err := filepath.Rel(dir, path)
  			if err != nil {
  				templateErr = err
  				return err
  			}
  
  			ext := filepath.Ext(rel)
  
  			if ext == extension {
  				buf, err := ioutil.ReadFile(path)
  				if err != nil {
  					templateErr = err
  					return err
  				}
  
  				buf = blackfriday.MarkdownCommon(buf)
  				if e.Config.Sanitize {
  					buf = bluemonday.UGCPolicy().SanitizeBytes(buf)
  				}
  
  				if err != nil {
  					templateErr = err
  					return err
  				}
  				name := filepath.ToSlash(rel)
  				e.templateCache[name] = buf
  
  			}
  		}
  		return nil
  	})
  
  	return templateErr
  
  }
docs: // LoadDirectory builds the markdown templates