diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-19 18:08:20 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 15:00:30 +0100 |
commit | 7256573a630f9a4c1da3532a6dc0e2cdbf411411 (patch) | |
tree | 29a12e6d9b2f962366f42b0928f404327335a20c /packages/gitbook-markdown/test | |
parent | 0b3b135a3935a4f64843e673b70925d8495e271f (diff) | |
download | gitbook-7256573a630f9a4c1da3532a6dc0e2cdbf411411.zip gitbook-7256573a630f9a4c1da3532a6dc0e2cdbf411411.tar.gz gitbook-7256573a630f9a4c1da3532a6dc0e2cdbf411411.tar.bz2 |
Add basic parsing of markdown using kramed
Diffstat (limited to 'packages/gitbook-markdown/test')
-rw-r--r-- | packages/gitbook-markdown/test/fixtures/PAGE.md | 14 | ||||
-rw-r--r-- | packages/gitbook-markdown/test/page.js | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/packages/gitbook-markdown/test/fixtures/PAGE.md b/packages/gitbook-markdown/test/fixtures/PAGE.md new file mode 100644 index 0000000..98b2721 --- /dev/null +++ b/packages/gitbook-markdown/test/fixtures/PAGE.md @@ -0,0 +1,14 @@ +# Python basics + +Python is a nice language, you can add stuff. Bla bla bla. + +Some more nice content .... + +[Cool stuff](http://gitbook.io) + +[Link to another Markdown file](./xyz/file.md) + +And look at this pretty picture: + + +Lets go for another exercise but this time with some context : diff --git a/packages/gitbook-markdown/test/page.js b/packages/gitbook-markdown/test/page.js new file mode 100644 index 0000000..158f09f --- /dev/null +++ b/packages/gitbook-markdown/test/page.js @@ -0,0 +1,22 @@ +var fs = require('fs'); +var path = require('path'); +var assert = require('assert'); + +var page = require('../').page; + +function loadPage (name, options) { + var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/' + name + '.md'), 'utf8'); + return page(CONTENT, options).sections; +} + +var LEXED = loadPage('PAGE'); + +describe('Page parsing', function() { + it('should detect sections', function() { + assert.equal(LEXED.length, 1); + }); + + it('should gen content for normal sections', function() { + assert(LEXED[0].content); + }); +}); |