mdown.html
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>RequireJS Markdown plugin</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="wrapper">
<h1>RequireJS Markdown plugin</h1>
<p>Helper for loading Markdown files, it will precompile Markdown files into HTML during optimization and wrap them into <code>define()</code> calls.</p>
<p>
If you set <code>pragmasOnSave.excludeMdown=true</code> the plugin code will be removed during the build, so it won't affect filesize.
</p>
<h2>Output:</h2>
<div id="output" style="border:1px solid #ccc; background:#f5f5f5; padding:10px 20px"></div>
</div>
<script src="../lib/require.js"></script>
<script>
require.config({
waitSeconds : 2,
paths : {
text : '../lib/text', //text is required
markdownConverter : '../lib/Markdown.Converter', //used by plugin
mdown : '../src/mdown' //alias to plugin
}
});
require(['mdown!data/foo.md', 'mdown!data/bar.md'], function(foo, bar){
var out = document.getElementById('output');
// data will be compiled into HTML
out.innerHTML += foo;
out.innerHTML += bar;
});
</script>
</body>
</html>