const gulp = require('gulp')
const through = require('through2')

function Renderer() {}

Renderer.prototype.apply = function(compiler) {
  //now you have access to all the compiler instance methods
  compiler.plugin('done', function() {
    gulp
      .src('../../content/**/*.md')
      .pipe(render())
      .pipe(gulp.dest('./public'))
  })
}

function render(content) {
  const renderPage = require('../server')

  return through.obj(function(file, encoding, callback) {
    // chang path extension to html
    file.path = file.path.replace('.md', '.html')

    // operate on contents
    const content = file.contents.toString()
    const buf = Buffer.from(renderPage(content))
    file.contents = buf

    callback(null, file)
  })
}

module.exports = Renderer

@@ -57,16 +57,167 @@
 rough2')
+%0Aconst path = require('path')%0A%0Aconst contentPath = path.resolve(__dirname, '../../content/')%0Aconst publicPath = path.resolve(__dirname, '../../public')
 %0A%0Afuncti
@@ -402,30 +402,31 @@
    .src(
-'../../
 content
+Path + '
 /**/*.md
@@ -476,18 +476,18 @@
 est(
-'./
 public
-'
+Path
 ))%0A 

Fix relative paths in render script.