Write literate code in Markdown, then use gulp-literature to extract code blocks and pipe them to a compiler.