librelist archives

« back to archive

Jinja filter list, markdown filter

Jinja filter list, markdown filter

From:
Marian Steinbach
Date:
2012-04-24 @ 10:56
Hi!

A preliminary question: Which version of Jinja is currently installed
with flask, when I install flask the usual way via pip install Flask?

I was looking for a way to output styled text in my templates and
thought that markdown would be a nice way to go. In this list

  http://wsgiarea.pocoo.org/jinja/docs/filters.html

a markdown filter exists. But I can't apply it in my Flask app. I get
the error that markdown is unknown. Same goes for nl2br, for example.

So I'm wondering what the meaning of this list is. Is it about a
different Jinja version? Or do I have to activate filters in some way?

Thanks for your help!

Marian

Re: [flask] Jinja filter list, markdown filter

From:
Bastian Hoyer
Date:
2012-04-24 @ 11:14
I think your link is from the jinja 1 documentation.
The Jinja 2 documentation is at http://jinja.pocoo.org/docs/.

I don't think jinja2/flask comes with a markdown package, bug it is
really easy to add your own filters to your app, an example is at
http://flask.pocoo.org/docs/templating/#registering-filters

Bastian

On Tue, Apr 24, 2012 at 12:56, Marian Steinbach <marian@sendung.de> wrote:
> Hi!
>
> A preliminary question: Which version of Jinja is currently installed
> with flask, when I install flask the usual way via pip install Flask?
>
> I was looking for a way to output styled text in my templates and
> thought that markdown would be a nice way to go. In this list
>
>  http://wsgiarea.pocoo.org/jinja/docs/filters.html
>
> a markdown filter exists. But I can't apply it in my Flask app. I get
> the error that markdown is unknown. Same goes for nl2br, for example.
>
> So I'm wondering what the meaning of this list is. Is it about a
> different Jinja version? Or do I have to activate filters in some way?
>
> Thanks for your help!
>
> Marian

Re: [flask] Jinja filter list, markdown filter

From:
Marian Steinbach
Date:
2012-04-24 @ 11:23
That helps a great deal. Thanks!

Marian


Am 24. April 2012 13:14 schrieb Bastian Hoyer <dafire@gmail.com>:
> I think your link is from the jinja 1 documentation.
> The Jinja 2 documentation is at http://jinja.pocoo.org/docs/.
>
> I don't think jinja2/flask comes with a markdown package, bug it is
> really easy to add your own filters to your app, an example is at
> http://flask.pocoo.org/docs/templating/#registering-filters
>
> Bastian

Re: [flask] Jinja filter list, markdown filter

From:
David Shawley
Date:
2012-04-24 @ 12:37
On Tue, Apr 24, 2012 at 6:56 AM, Marian Steinbach <marian@sendung.de> wrote:
> Hi!
>
> A preliminary question: Which version of Jinja is currently installed
> with flask, when I install flask the usual way via pip install Flask?
>

Hi Marian,

I think that you already have an answer to your question, but here is
a few useful tips about pip.  You can use "pip freeze" to figure out
what versions are installed.

   (flask-env) src$ pip freeze | grep Jinja
   Jinja2==2.6

If you are using "pip install -r" with a requirements file, then you
can wire the version using something like the following which is what
I am using for Flask 0.8 in some current projects:

   # requirements.txt
   Flask==0.8
   Flask-OpenID>=1.0.1
   Jinja==2.6
   Werkzeug==0.8.2
   pymongo==2.1
   wsgiref==0.1.2

What I haven't found is a good way to know what the requirements for a
specific package are short of either examining the package after it is
installed.  You can always look for requirements.txt inside of the
egg-info directories.

- dave

--
Reusing pieces of code is like picking off sentences from other
people's stories and trying to make a magazine article -- Bob
Frankston

Re: [flask] Jinja filter list, markdown filter

From:
Marian Steinbach
Date:
2012-04-24 @ 14:39
Cool stuff, thanks Dave!

Marian


> Hi Marian,
>
> I think that you already have an answer to your question, but here is
> a few useful tips about pip.  You can use "pip freeze" to figure out
> what versions are installed.
>
>   (flask-env) src$ pip freeze | grep Jinja
>   Jinja2==2.6
>
> If you are using "pip install -r" with a requirements file, then you
> can wire the version using something like the following which is what
> I am using for Flask 0.8 in some current projects:
>
>   # requirements.txt
>   Flask==0.8
>   Flask-OpenID>=1.0.1
>   Jinja==2.6
>   Werkzeug==0.8.2
>   pymongo==2.1
>   wsgiref==0.1.2
>
> What I haven't found is a good way to know what the requirements for a
> specific package are short of either examining the package after it is
> installed.  You can always look for requirements.txt inside of the
> egg-info directories.
>
> - dave