serving markdown directly : any suggestions?
Piero Wbmstr
me at e-piwi.fr
Wed Feb 4 04:51:42 EST 2015
Hello,
I have some personal (public) work that could interest you:
- first a simple PHP parser [6]
(https://github.com/piwi/markdown-extended) quite easy to use and you
can run on any server using PHP 5.3+
- then an online webservice to transform a markdown content available at
http://api.aboutmde.org/ [7] that uses a simple Webservice interface
available at https://github.com/piwi/mde-service [8] (with the
documentation of the online tool)
- finally, a simple Apache configuration to display any ".md" file
parsing it with the PHP parser: https://github.com/piwi/mde-cgi [9]
Hope this could help.
-- piwi
Le 04.02.2015 10:36, mofo syne a écrit :
> Okay then, well if you are running in php, and you got the parsedown.php file as well, then you can give this a shot.
>
> Just modify the .htaccess file rewrite rule from "RewriteCond %{REQUEST_URI} ^(.*).md" to "RewriteCond %{REQUEST_URI} ^(.*).html"
>
> See if that works for you.
>
> Cheers,
> ==============
>
> <?php
> /*
> Coder: Brian Khuu briankhuu.com [1]
> Purpose: To allow for displaying of .md file transparently to visitors via http://parsedown.org [2] and mod_rewrite
> Usage: Place this file (parsedownRender.php) in your root directory and add these lines below to your .htaccess file
>
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteCond %{REQUEST_URI} ^(.*).md
> RewriteRule . /parsedownRender.php?css=/css/markdown1.css&file=%{REQUEST_URI} [L]
> </IfModule>
>
> */
> $file = "./".$_GET["file"]; // 'file' => /md/test.md [3]
> $css = ( $_GET['css']!="" ) ? htmlspecialchars($_GET['css']) : "/css/style.css";
>
> function parsedownInclude($f){
> require_once 'Parsedown.php';
> $Parsedown = new Parsedown();
> echo is_readable($f) ? $Parsedown->text(file_get_contents($f)) : "File Not Found: ".htmlspecialchars($f);
> }
> ?>
> <!DOCTYPE html>
> <head><link rel="stylesheet" type="text/css" href="<?php echo $css ?>" /></head>
> <body>
> <?php parsedownInclude($file) ?>
> </body>
> </html>
>
> On Wed, Feb 4, 2015 at 8:29 PM, Mayuresh Kathe <mayuresh at kathe.in> wrote:
> i did muse around with that approach, but, that's not what is expected for my use case.
>
> i need the markdown content to be dynamically transformed to (x)html on the server.
> this is to allow collaborators on the documentation to send in only diff files for corrections, additions, etc. which would be plain-text, which is easier to understand for non web (html + css) developers.
>
> i guess i missed mentioning the project for which i am doing this, it is for the "openbsd faq".
>
> this is just a test run, once i succeed, i intend to convert the entire "faq" to markdown, probably by hand, set up a server for the demo, before submitting it to the openbsd crowd for consideration.
>
> ~mayuresh
>
> On 2015-02-04 14:50, mofo syne wrote:
> Have you considered compiling the website on your computer first then
> uploading it as a static website?
>
> E.g. via Jekyll?
> hi,
>
> have been tinkering with markdown for a few hours now, so am still a
> noob.
>
> would like to use it for a documentation project which will be served
> over the web.
>
> need to know if there's any way to transform markdown content to
> (x)html on the fly at the web server level?
>
> use case:
> a web server with the above capabilities would have the document root
> folder holding a bunch of markdown files and a 'css' file.
> on visiting that web server's address over 'http', the index.md [4] [1]
> file would get transformed into (x)html, pick-up the 'css' and show a
> beautiful page to the visitor.
> all this, while i would be busy writing plain old markdown.
>
> i am sorry if this has been asked out here before, but i couldn't
> find any such queries, perhaps my googling skills are bad. :)
>
> thanks,
>
> ~mayuresh
>
> _______________________________________________
> Markdown-Discuss mailing list
> Markdown-Discuss at six.pairlist.net
> https://pairlist6.pair.net/mailman/listinfo/markdown-discuss [5] [2]
>
> Links:
> ------
> [1] http://index.md [4]
> [2] https://pairlist6.pair.net/mailman/listinfo/markdown-discuss [5]
>
> _______________________________________________
> Markdown-Discuss mailing list
> Markdown-Discuss at six.pairlist.net
> https://pairlist6.pair.net/mailman/listinfo/markdown-discuss [5]
_______________________________________________
Markdown-Discuss mailing list
Markdown-Discuss at six.pairlist.net
https://pairlist6.pair.net/mailman/listinfo/markdown-discuss [5]
Links:
------
[1] http://briankhuu.com
[2] http://parsedown.org
[3] http://test.md
[4] http://index.md
[5] https://pairlist6.pair.net/mailman/listinfo/markdown-discuss
[6] https://github.com/piwi/markdown-extended
[7] http://api.aboutmde.org/
[8] https://github.com/piwi/mde-service
[9] https://github.com/piwi/mde-cgi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist6.pair.net/pipermail/markdown-discuss/attachments/20150204/74a13e24/attachment.html>
More information about the Markdown-Discuss
mailing list