diff options
Diffstat (limited to 'packages/gitbook-core/src/models/File.js')
-rw-r--r-- | packages/gitbook-core/src/models/File.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/gitbook-core/src/models/File.js b/packages/gitbook-core/src/models/File.js index 03032a1..88138c3 100644 --- a/packages/gitbook-core/src/models/File.js +++ b/packages/gitbook-core/src/models/File.js @@ -21,16 +21,14 @@ class File extends Record(DEFAULTS) { } /** - * Return url for a file in a GitBook context. - * @param {Context} context - * @return {String} url + * Returns the relative path from this file to "to" + * @param {String} to + * @return {String} */ - toURL(context) { - const { file } = context.getState(); - + relative(to) { return path.relative( - path.dirname(file.path), - this.path + path.dirname(this.path), + to ); } |