diff options
-rw-r--r-- | packages/gitbook-markdown/lib/page.js | 5 | ||||
-rw-r--r-- | packages/gitbook-markdown/package.json | 2 | ||||
-rw-r--r-- | packages/gitbook-markdown/test/page.js | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/packages/gitbook-markdown/lib/page.js b/packages/gitbook-markdown/lib/page.js index 6f1f86b..afa26fd 100644 --- a/packages/gitbook-markdown/lib/page.js +++ b/packages/gitbook-markdown/lib/page.js @@ -56,7 +56,10 @@ function preparePage(src) { function parsePage(src) { var options = _.extend({}, kramed.defaults, { - mathjax: false + mathjax: false, + renderer: new kramed.Renderer({ + headerAutoId: false + }) }); return { diff --git a/packages/gitbook-markdown/package.json b/packages/gitbook-markdown/package.json index 224b21f..fac067f 100644 --- a/packages/gitbook-markdown/package.json +++ b/packages/gitbook-markdown/package.json @@ -6,7 +6,7 @@ "main": "lib/index.js", "dependencies": { "lodash": "^3.2.0", - "kramed": "0.5.1", + "kramed": "0.5.3", "kramed-text-renderer": "0.2.1" }, "devDependencies": { diff --git a/packages/gitbook-markdown/test/page.js b/packages/gitbook-markdown/test/page.js index ca3b4ef..8f4b5c5 100644 --- a/packages/gitbook-markdown/test/page.js +++ b/packages/gitbook-markdown/test/page.js @@ -20,6 +20,11 @@ describe('Page parsing', function() { assert(LEXED[0].content); }); + it('should not add id to headings', function() { + assert.equal(page('# Hello').sections[0].content, '<h1>Hello</h1>\n'); + assert.equal(page('# Hello {#test}').sections[0].content, '<h1 id="test">Hello </h1>\n'); + }); + it('should escape codeblocks in preparation (1)', function() { assert.equal(page.prepare("Hello `world`"), "Hello {% raw %}`world`{% endraw %}"); assert.equal(page.prepare("Hello `world test`"), "Hello {% raw %}`world test`{% endraw %}"); |