-
-
Save mattjdever/7e717b20ef58bcc86f0c to your computer and use it in GitHub Desktop.
jquery loading a markdown file and encoding as html
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
<script> | |
// get markdown content | |
var body_location = 'markdown/README.markdown'; | |
function getText(myUrl){ | |
var result = null; | |
$.ajax( { url: myUrl, | |
type: 'get', | |
dataType: 'html', | |
async: false, | |
success: function(data) { result = data; } | |
} | |
); | |
FileReady = true; | |
return result; | |
} | |
var markdown_source = getText(body_location); | |
// convert markdown to html | |
var output = markdown.toHTML( markdown_source ); | |
document.write(output); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment