-
-
Save martowu/07812ab9e5d7ab6d6345b418dbfe3108 to your computer and use it in GitHub Desktop.
Web page with dynamic loading and conversion of Markdown to 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>My Markdown Content</title> | |
<meta name="viewport" content="width=device-width" > | |
<style> | |
#status { | |
font-style: italic; | |
} | |
</style> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<!-- Obtain Markdown.Converter.js from http://code.google.com/p/pagedown/ --> | |
<script src="Markdown.Converter.js"></script> | |
<script> | |
$(document).ready(function() { | |
$("#status").html("<p>Loading page content...</p>"); | |
// Load the Markdown file and convert it to HTML for display | |
var markdownURL = "mycontent.markdown"; | |
$.get(markdownURL, function(markdownContent) { | |
var converter = new Markdown.Converter(); | |
var htmlContent = converter.makeHtml(markdownContent); | |
$("div#content").html(htmlContent); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="content"> | |
<div id="status"> | |
<p>JavaScript must be enabled in your browser to view this page.</p> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment