mdown.html 1.5 KB
<!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>