Created
June 24, 2012 14:11
-
-
Save zeffii/2983357 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> |
If I don't know the name of the markdown file. Can I use its extension to import it ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you~