diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-06 16:41:23 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 15:00:36 +0100 |
commit | 8e2f8f0b469a57b0898d781874d108a359fa2b90 (patch) | |
tree | d7296617d78f9bb4de6bda142154c446a3bdd14c /packages/gitbook-markdown/test | |
parent | e8f309f35071f9140225e2d8aeca23c6a6a1d329 (diff) | |
download | gitbook-8e2f8f0b469a57b0898d781874d108a359fa2b90.zip gitbook-8e2f8f0b469a57b0898d781874d108a359fa2b90.tar.gz gitbook-8e2f8f0b469a57b0898d781874d108a359fa2b90.tar.bz2 |
Add method page.prepare to escape codeblock
Related to GitbookIO/gitbook#625
Diffstat (limited to 'packages/gitbook-markdown/test')
-rw-r--r-- | packages/gitbook-markdown/test/page.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/gitbook-markdown/test/page.js b/packages/gitbook-markdown/test/page.js index 158f09f..8486435 100644 --- a/packages/gitbook-markdown/test/page.js +++ b/packages/gitbook-markdown/test/page.js @@ -19,4 +19,16 @@ describe('Page parsing', function() { it('should gen content for normal sections', function() { assert(LEXED[0].content); }); + + it('should escape codeblocks in preparation', function() { + assert.equal(page.prepare("Hello `world`"), "Hello {% raw %}`world`{% endraw %}"); + assert.equal( + page.prepare("Hello\n\n\n\tworld\n\thello\n\n\ntest"), + "Hello\n{% raw %}\n\n\tworld\n\thello\n\n\n{% endraw %}test" + ); + assert.equal( + page.prepare("Hello\n\n\n\tworld\n\thello\n\n\n"), + "Hello\n{% raw %}\n\n\tworld\n\thello\n\n\n{% endraw %}" + ); + }); }); |