Skip to content

Instantly share code, notes, and snippets.

@robwiss
Last active December 6, 2016 18:36
Show Gist options
  • Save robwiss/34f7780737351554558659c107360d53 to your computer and use it in GitHub Desktop.
Save robwiss/34f7780737351554558659c107360d53 to your computer and use it in GitHub Desktop.
--- /root/src/gitlist/themes/default/js/showdown.js 2014-09-02 17:06:41.000000000 -0400
+++ showdown.js 2016-12-06 13:35:16.933049198 -0500
@@ -746,6 +746,15 @@
}
}
+ var isAbs = new RegExp('^(?:[a-z]+:)?//', 'i');
+ if (! isAbs.test(url))
+ {
+ var currentlocation = window.location['href'];
+ var location = currentlocation.match( new RegExp('.*/') )[0]
+ var location = location.replace( /(\/blob\/|\/tree\/)/g ,"/raw/");
+ url = location + url;
+ }
+
alt_text = alt_text.replace(/"/g,""");
url = escapeCharacters(url,"*_");
var result = "<img src=\"" + url + "\" alt=\"" + alt_text + "\"";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment