fixes #18 relative link bug

This commit is contained in:
Matthew Scragg 2014-09-20 17:15:12 -05:00
parent 813d7cfc51
commit b637ce5df9
3 changed files with 12 additions and 7 deletions

View file

@ -1,6 +1,3 @@
body {
}
.navbar { .navbar {
height: 50px !important; height: 50px !important;
min-height: 49px !important; min-height: 49px !important;

View file

@ -58,7 +58,7 @@ hljs.initHighlightingOnLoad();
var MDR = { var MDR = {
meta: null, meta: null,
md: null, md: null,
sanitize: true, // Override sanitize: false, // Override
parse: function(md){ return marked(md); }, parse: function(md){ return marked(md); },
convert: function(md, sanitize){ convert: function(md, sanitize){
if (this.sanitize !== null) { if (this.sanitize !== null) {
@ -75,9 +75,17 @@ var MDR = {
if (sanitize) { if (sanitize) {
// Causes some problems with inline styles // Causes some problems with inline styles
html = html_sanitize(html, function(url) { html = html_sanitize(html, function(url) {
if(/^(\/|https?:\/\/)/.test(url)) { try {
return url var prot = decodeURIComponent(unescape(url))
.replace(/[^\w:]/g, '')
.toLowerCase();
} catch (e) {
return '';
} }
if (prot.indexOf('javascript:') === 0) {
return '';
}
return prot;
}, function(id){ }, function(id){
return id; return id;
}); });

View file

@ -8,7 +8,7 @@ with open('README.md') as f:
with open('requirements.txt') as f: with open('requirements.txt') as f:
required = f.read().splitlines() required = f.read().splitlines()
VERSION = '0.1.9' VERSION = '0.1.10'
CLASSIFIERS = [ CLASSIFIERS = [
'Intended Audience :: Developers', 'Intended Audience :: Developers',