SHOW:
|
|
- or go back to the newest paste.
1 | <!-- | |
2 | Serves my_site.com/markdown-pages/foo.md as my_site.com/foo | |
3 | ||
4 | - | This assumes you have a /markdown-pages directory in your server. Download "pagedown", a Markdown --> HTML converter there. |
4 | + | This assumes you have a /markdown-pages directory in your server. Download "pagedown", a Markdown -> HTML converter there. |
5 | ||
6 | Save this page as /markdown-pages/index.html | |
7 | ||
8 | Then, for each Markdown file you create, e.g. my_site.com/markdown-pages/foo.md, make a symbolic link, | |
9 | ||
10 | > cd /path/to/www/root | |
11 | > ln -s markdown-pages/index.html foo | |
12 | --> | |
13 | <html> | |
14 | <head> | |
15 | <script src="/markdown-pages/Markdown.Converter.js" type="text/javascript"></script> | |
16 | <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
17 | <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> | |
18 | <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
19 | <script type="text/javascript"> | |
20 | $(function() { | |
21 | var page_name = window.location.pathname.substring(1); | |
22 | $.get("markdown-pages/" + page_name + ".md", function (data) { | |
23 | var converter = new Markdown.Converter(); | |
24 | $("div.container").html(converter.makeHtml(data)); | |
25 | }); | |
26 | }); | |
27 | </script> | |
28 | </head> | |
29 | <body> | |
30 | <div class="container"> | |
31 | Loading .... | |
32 | </div> | |
33 | </body> | |
34 | </html> |