Skip to content

Instantly share code, notes, and snippets.

@mitgr81
Created April 15, 2013 20:51
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 mitgr81/5391201 to your computer and use it in GitHub Desktop.
Save mitgr81/5391201 to your computer and use it in GitHub Desktop.
Simple bootstrapped markdown renderer in Flask.
{% extends "bootstrap_base.html" %}
{%block body_content %}
<div class="container">
{{my_html}}
</div>
{%endblock body_content %}
#!/usr/bin/env python
from flask import Flask, render_template, Markup
from flask.ext.bootstrap import Bootstrap
import markdown2
app = Flask(__name__)
Bootstrap(app)
@app.route("/")
@app.route("/favicon.ico")
def read_file():
marked_text = ''
with open("README.md") as f:
marked_text = markdown2.markdown(f.read())
return render_template('index.html', my_html=Markup(marked_text))
if __name__ == "__main__":
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment