From 1f9d6a06a32ad91b1a33f3b6bd714af04721f92d Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Tue, 1 Nov 2016 13:36:34 -0400 Subject: [PATCH] Use path.join for toc source Possible fix for https://github.com/docpress/docpress/issues/169 --- lib/tocify.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tocify.js b/lib/tocify.js index f36abbd..b9fa6a7 100644 --- a/lib/tocify.js +++ b/lib/tocify.js @@ -2,7 +2,7 @@ /* eslint-disable no-cond-assign */ const marked = require('marked') -const normalize = require('path').normalize +const path = require('path') const stripMarkdown = require('./helpers/strip_markdown') const assign = Object.assign @@ -216,8 +216,8 @@ function anchorize (source) { */ function absolutify (source, root) { - if (source.substr(0, 1) !== '/') { - source = normalize(root + '/' + source) + if (source.substr(0, 1) !== path.sep) { + source = path.normalize(path.join(root, source)) } source = source.replace(/^\//, '') return { source }