Skip to content

Instantly share code, notes, and snippets.

@atupal
Created April 8, 2013 17:08
Show Gist options
  • Save atupal/5338506 to your computer and use it in GitHub Desktop.
Save atupal/5338506 to your computer and use it in GitHub Desktop.
two way to use mark down in python
first way:
{{ content }}
second way:
{% filter markdown %}
Your Markdown
=============
{% endfilter %}
or:
{{ mkd|markdown }}
from application import app
import markdown
from flask import render_template
from flask import Markup
from flaskext.markdown import Markdown
Markdown(app)
@app.route("/blog")
def blog():
content = open(app.config['APPLICATION_ROOT_DIR'] + 'tests/test_post.markdown', 'r').read()
return render_template('views/blog.html', content = content)
#content = Markup(markdown.markdown(content))
#return render_template('views/blog.html', **locals())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment