python 2.7 - Inserting images using Flask-FlastPages -


i have created blog using flask-flatpages , posts in markdown, challenge i'm having inserting images in blog post. traditional way of inserting images in markdown not working.

i tried without success:

![image]({{ url_for('static', filename="img/my_image.jpg") }}) 

here worked me. turns out flatpages_html_renderer needed achieve goal.

here code:

def my_renderer(text):     prerendered_body = render_template_string(text)     return pygmented_markdown(prerendered_body)  app = flask(__name__) app.config['flatpages_html_renderer'] = my_renderer pages = flatpages(app) 

this discussed on post: https://github.com/simonsapin/flask-flatpages/pull/1


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -