diff --git a/adapters/compilers.coffee b/adapters/compilers.coffee index 448d161..2c661b9 100644 --- a/adapters/compilers.coffee +++ b/adapters/compilers.coffee @@ -48,6 +48,15 @@ module.exports = new Adapter throw err if err cb css + md: (file, cb) -> + marked = require 'marked' + + marked.setOptions Adapter.getOptions(this) + + file.read (code) -> + compiled = marked code + cb compiled + hbs: (file, cb) -> handlebars = require 'handlebars' diff --git a/test/compilers/markdown.spec.coffee b/test/compilers/markdown.spec.coffee new file mode 100644 index 0000000..7ab8916 --- /dev/null +++ b/test/compilers/markdown.spec.coffee @@ -0,0 +1,27 @@ +flour = require '../../flour' +should = require 'should' + +flour.silent() + +describe 'Markdown compiler', -> + + input_file = "#{dir.sources}/simple.md" + output_file = "#{dir.temp}/simple.html" + + it 'should compile markdown and return the output', (done) -> + flour.compile input_file, (output) -> + output.should.include """ +

H1

+

Hello, paragraph.

+

H2

+ """ + done() + + it 'should compile markdown to a file', (done) -> + flour.compile input_file, output_file, -> + readFile(output_file).should.include """ +

H1

+

Hello, paragraph.

+

H2

+ """ + done() diff --git a/test/sources/simple.md b/test/sources/simple.md new file mode 100644 index 0000000..53f1b6b --- /dev/null +++ b/test/sources/simple.md @@ -0,0 +1,6 @@ +H1 +=============== + +Hello, paragraph. + +## H2 \ No newline at end of file