Skip to content

Commit

Permalink
Add markdown parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobeat committed May 14, 2013
1 parent d7eb630 commit 78d1a70
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
9 changes: 9 additions & 0 deletions adapters/compilers.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
27 changes: 27 additions & 0 deletions test/compilers/markdown.spec.coffee
Original file line number Diff line number Diff line change
@@ -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>H1</h1>
<p>Hello, paragraph.</p>
<h2>H2</h2>
"""
done()

it 'should compile markdown to a file', (done) ->
flour.compile input_file, output_file, ->
readFile(output_file).should.include """
<h1>H1</h1>
<p>Hello, paragraph.</p>
<h2>H2</h2>
"""
done()
6 changes: 6 additions & 0 deletions test/sources/simple.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
H1
===============

Hello, paragraph.

## H2

0 comments on commit 78d1a70

Please sign in to comment.