mdown.html 1.5 KB

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