Skip to content

Instantly share code, notes, and snippets.

@tsaarni
Last active August 29, 2017 19:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsaarni/67222455916ac38d94e8 to your computer and use it in GitHub Desktop.
Save tsaarni/67222455916ac38d94e8 to your computer and use it in GitHub Desktop.
Configure Apache to render markdown files automatically
#!/bin/bash
#
# To make apache render files ending with .md with strapdown.js
# markdown renderer (http://strapdownjs.com/), add following lines
# to /etc/apache2/httpd.conf:
#
# Action markdown /cgi-bin/strapdown.cgi
# AddHandler markdown .md
# DirectoryIndex index.html index.md
#
# then enable mod_actions by running "a2enmod actions" and store
# this script to cgi-bin directory as file strapdown.cgi. Finally
# restart apache.
#
cat <<DOCUMENT
Content-type: text/html
<!DOCTYPE html>
<html>
<title>$(basename "$PATH_INFO")</title>
<xmp theme="united" style="display:none;">
$(cat "$PATH_TRANSLATED")
</xmp>
<script src="//strapdownjs.com/v/0.2/strapdown.js"></script>
</html>
DOCUMENT
@JamesKingdom
Copy link

/cgi-bin/strapdown.cgi/images/wintile/README.md was not found on this server.

:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment