diff options
author | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-06-08 12:31:52 -0700 |
---|---|---|
committer | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-06-08 12:31:52 -0700 |
commit | b425db0979a878cd27a3327df9ea76ec9db5a8bb (patch) | |
tree | df97c8552b7b737940247b260c774de56b95daa9 /lib/utils | |
parent | 30c6d1c9de45d5f92086131c505712fb67c833a9 (diff) | |
download | gitbook-b425db0979a878cd27a3327df9ea76ec9db5a8bb.zip gitbook-b425db0979a878cd27a3327df9ea76ec9db5a8bb.tar.gz gitbook-b425db0979a878cd27a3327df9ea76ec9db5a8bb.tar.bz2 |
Allow external links in summary, fixes #300
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/links.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/utils/links.js b/lib/utils/links.js index c965dd9..6606bbf 100644 --- a/lib/utils/links.js +++ b/lib/utils/links.js @@ -1,6 +1,11 @@ var url = require('url'); var path = require('path'); +// Is the link an external link +var isExternal = function(href) { + return Boolean(url.parse(href).protocol); +}; + // Return true if the link is relative var isRelative = function(href) { var parsed = url.parse(href); @@ -41,6 +46,7 @@ var join = function() { module.exports = { isRelative: isRelative, + isExternal: isExternal, toAbsolute: toAbsolute, join: join -};
\ No newline at end of file +}; |