Put it all together and see if anything works.

This commit is contained in:
Jan Philipp Timme 2018-03-13 11:58:02 +01:00
parent 8f2a322b37
commit 9775973311
2 changed files with 16 additions and 0 deletions

View File

@ -3,8 +3,13 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>This page is powered by Markdown.js</title> <title>This page is powered by Markdown.js</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.8.6/showdown.min.js">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</head> </head>
<body> <body>
<h1>Hello World! (for now ...)</h1> <h1>Hello World! (for now ...)</h1>
<div id="markdown-content">TODO</div>
<!-- That is all we need, now load the script and get going! -->
<script type="text/javascript" src="use-markdown.js"></script>
</body> </body>
</html> </html>

11
use-markdown.js Normal file
View File

@ -0,0 +1,11 @@
"use strict";
function loadMdFromUrl(url) {
$.get(url, function(date) {
var converter = new showdown.Converter();
var html = converter.makeHtml(text);
$("#markdown-content").html(html);
});
// TODO: Add more, add menu, add ...
loadMdFromUrl("content/hello.md");