Skip to content

Instantly share code, notes, and snippets.

@garbados
Created May 20, 2013 22:15
Show Gist options
  • Save garbados/5616037 to your computer and use it in GitHub Desktop.
Save garbados/5616037 to your computer and use it in GitHub Desktop.
Use like this: `cat [filename].md | md2flask` It kicks up a Flask server that renders the markdown as HTML for your viewing pleasure. Change `/usr/bin/python` to whatever your terminal returns for `which python`, run `chmod +x md2flask`, add it to your $PATH, do a little dance, make a little love, and you should be alright.
#!/usr/bin/python
import flask
import markdown
import sys
app = flask.Flask(__name__)
md = sys.stdin.read()
@app.route('/')
def index():
return markdown.markdown(md)
if __name__ == '__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment