#!/bin/sh # Markdown v1.1.1 2007/05/24 # Build an HTML page (with headers) from Markdown.pl output. INCLUDES=/home/web/www.reppep.com/include TITLE=`head -1 $PATH_TRANSLATED | cut -f2` echo "Content-type: text/html" echo cat $INCLUDES/head1.incl echo $TITLE cat $INCLUDES/head2.incl # If we already have an H1, don't insert one. if ! grep --silent '^# ' $PATH_TRANSLATED then echo -n '

' echo -n $TITLE echo '

' echo fi /usr/local/bin/Markdown.pl < $PATH_TRANSLATED cat $INCLUDES/foot.incl exit 0 # http://www.extrapepperoni.com/2007/05/24/markdowncgi-using-markdown-in-apache-httpd/ # http://daringfireball.net/projects/markdown/ # To use, copy Markdown.cgi (this wrapper, which you may have to rename # from Markdown.txt) and Markdown.pl (from Daring Fireball) into your # cgi-bin/ and make them executable # ("chmod +x Markdown.cgi Markdown.pl"), set the correct path for # INCLUDES below, and install head1.incl (HTML header up to ), # head2.incl (HTML header starting with ), and foot.incl in # that directory. # Markdown.cgi reads the page's title from the first line, starting # after the first tab and ending before the second. # Your document's title should be inside an HTML comment, set off by tabs. # The title line contains 5 parts: # 1) the HTML comment open delimiter (less-bang-dash-dash) # 2) a tab # 3) the title text # 4) a tab # 5) the HTML comment close delimiter (dash-dash-greater) # For example (not counting the # on the next line): # # Add the following to your Apache httpd configuration # (likely httpd.conf or a virtual host .conf file): # AddHandler markdown .text # Action markdown /cgi-bin/Markdown.cgi # AddType text/html .text # ScriptAlias /cgi-bin/ /home/web/www.reppep.com/cgi-bin/ # AddType text/html .pl