diff --git a/share/index.md b/share/index.md index 03784289c..c3776e1d5 100644 --- a/share/index.md +++ b/share/index.md @@ -15,6 +15,13 @@ window.onload = function() { if (!conv) { return; } + // Check if the URL is a non-raw GitHub gist + var gistRegex = /^https:\/\/gist\.github\.com\/[^\/]+\/([a-f0-9]+)$/; + var match = gistRegex.exec(conv); + if (match) { + // If it is, convert it into a raw URL + conv = 'https://gist.githubusercontent.com/' + match[1] + '/raw'; + } fetch(conv) .then(response => response.text()) .then(markdown => {