Skip to content

Instantly share code, notes, and snippets.

@cato-
Created July 11, 2013 11:29
Show Gist options
  • Save cato-/5974656 to your computer and use it in GitHub Desktop.
Save cato-/5974656 to your computer and use it in GitHub Desktop.
Online Markdown Parser
#!/bin/bash
. ../venv/bin/activate
python ../md-parser.py
#!/usr/bin/env python
import cgi
import cgitb
cgitb.enable()
import requests
import markdown
# get args from cgi
args = cgi.FieldStorage()
url = args.getvalue('url')
if "shownot.es" in url:
r = requests.get(url)
t = r.json()['text']
html = markdown.markdown(t)
print "Content-Type: text/html; charset=utf-8"
print
print html.encode("utf8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment