Flask-RSTPages adds support for reStructuredText to your Flask application, allowing to convert a reStructuredText file to html. Source code is rendered via Pygments.
Install the extension with one of the following commands:
$ easy_install Flask-RSTPages
or alternatively if you have pip installed:
$ pip install Flask-RSTPages
To get started you must construct a RSTPages object with your Flask instance:
from flask.ext.rstpages import RSTPages
pages = RSTPages(app)
Then, you can use the RSTPages.get() method to convert your reStructuredText file to html:
@app.route('/<path:page>/')
def get_page(page):
html = pages.get(page)
return render_template("page.html", page=html)
The RSTPages.get() method returns an object with title and body attributes.
Flask-RSTPages accepts the following configuration values.