Created
April 15, 2013 20:51
-
-
Save mitgr81/5391201 to your computer and use it in GitHub Desktop.
Simple bootstrapped markdown renderer in Flask.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "bootstrap_base.html" %} | |
{%block body_content %} | |
<div class="container"> | |
{{my_html}} | |
</div> | |
{%endblock body_content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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