summaryrefslogtreecommitdiffstats
path: root/lib/utils
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-06-08 12:31:52 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-06-08 12:31:52 -0700
commitb425db0979a878cd27a3327df9ea76ec9db5a8bb (patch)
treedf97c8552b7b737940247b260c774de56b95daa9 /lib/utils
parent30c6d1c9de45d5f92086131c505712fb67c833a9 (diff)
downloadgitbook-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.js8
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
+};