Knitr preprocessing for Flask-FlatPages
Project description
Flask-FlatPages-Knitr preprocesses a Flask FlatPage using knitr such that code chunks are evaluated before the next step in the rendering process occurs.
Quickstart
First, install the knitr R package:
Rscript -e "install.packages('knitr')"
Right now, Flask-FlatPages-Knitr requires at least version 0.6 of Flat-FlatPages, which has not been released yet. Hence, you’ll have to install it from Github:
pip install git+git://github.com/SimonSapin/Flask-FlatPages/
Second, install Flask-FlatPages-Knitr from the Python Package Index:
pip install Flask-FlatPages-Knitr
Finally, you can simply add Flask-FlatPages-Knitr to your app:
from flask import Flask
from flask_flatpages import FlatPages
from flask_flatpages_knitr import FlatPagesKnitr
app = Flask(__name__)
app.config.from_object(__name__)
pages = FlatPages(app)
FlatPagesKnitr(app)
By default, FLATPAGES_HTML_RENDERER will be reused, which defaults to a Markdown implementation for Python. For more advanced Markdown rendering, Flask-FlatPages-Pandoc is recommended:
from flask_flatpages_pandoc import FlatPagesPandoc
FLATPAGES_EXTENSION = ".Rmd"
pages = FlatPages(app)
FlatPagesPandoc("markdown", "app", ["--mathjax"], pre_render=True)
FlatPagesKnitr(app)
Links
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for Flask-FlatPages-Knitr-0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 449066006e611a4a3753b16060da6360802d49b2d46aeb0a45678746e8383135 |
|
MD5 | c0be973d3d71a3d2678a2dce72fb95b7 |
|
BLAKE2b-256 | 09aea7a555b212da9dae8c1a02e6c40ad68832b27853572b4b80250233c71435 |