diff --git a/lib/handlers/code.js b/lib/handlers/code.js index 59e818a..ce159a4 100644 --- a/lib/handlers/code.js +++ b/lib/handlers/code.js @@ -2,11 +2,10 @@ module.exports = code -var detab = require('detab') var u = require('unist-builder') function code(h, node) { - var value = node.value ? detab(node.value + '\n') : '' + var value = node.value ? node.value + '\n' : '' var lang = node.lang && node.lang.match(/^[^ \t]+(?=[ \t]|$)/) var props = {} diff --git a/package.json b/package.json index f217326..1e5c5ff 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "dependencies": { "@types/mdast": "^3.0.0", "@types/unist": "^2.0.3", - "detab": "^2.0.0", "mdast-util-definitions": "^3.0.0", "mdurl": "^1.0.0", "trim-lines": "^1.0.0", diff --git a/test/code.js b/test/code.js index 795a17d..a6ab613 100644 --- a/test/code.js +++ b/test/code.js @@ -35,5 +35,13 @@ test('Code', function (t) { 'should transform `code` to a `pre` element with language class' ) + t.deepEqual( + to(u('code', '\ta')), + u('element', {tagName: 'pre', properties: {}}, [ + u('element', {tagName: 'code', properties: {}}, [u('text', '\ta\n')]) + ]), + 'should support tabs in code' + ) + t.end() })