Last active
August 2, 2018 04:38
-
-
Save ahaggart/d796a51bb1cb76f669ccc9ed2a872254 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new XMLHttpRequest(); | |
client.open('GET', 'content.md'); | |
client.onreadystatechange = function() { | |
var text = client.responseText; | |
var converter = new showdown.Converter(); | |
var options = [ | |
['openLinksInNewWindow', true], | |
['metadata', true], | |
['simplifiedAutoLink', true], | |
['excludeTrailingPunctuationFromURLs', true], | |
['literalMidWordUnderscores', true], | |
['literalMidWordAsterisks', true], | |
['strikethrough', true], | |
['tables', true], | |
['tasklists', true], | |
['parseImgDimensions', true], | |
]; | |
options.forEach((pair)=>converter.setOption(pair[0] ,pair[1])); | |
var html = converter.makeHtml(text); | |
var title = converter.getMetadata().title | |
if(title != undefined){ | |
document.title = title | |
} | |
document.getElementById("root").innerHTML = html; | |
} | |
client.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment