Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Jinja Markdown extension
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Fred Loney  
View profile  
 More options Oct 17 2012, 1:58 pm
From: Fred Loney <lon...@ohsu.edu>
Date: Wed, 17 Oct 2012 10:58:10 -0700 (PDT)
Local: Wed, Oct 17 2012 1:58 pm
Subject: Jinja Markdown extension

Is there a Markdown Jinja extension, along the lines of the Django extension<http://freewisdom.org/projects/python-markdown/Django>?
I want to serve markdown files formatted as HTML in the Klaus<https://github.com/jonashaag/klaus#readme> git
viewer, which uses Jinja.

Thanks,

Fred


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Sapin  
View profile  
 More options Oct 17 2012, 2:08 pm
From: Simon Sapin <simon.sa...@exyr.org>
Date: Wed, 17 Oct 2012 20:08:23 +0200
Local: Wed, Oct 17 2012 2:08 pm
Subject: Re: Jinja Markdown extension
Le 17/10/2012 19:58, Fred Loney a crit :

> Is there a Markdown Jinja extension, along the lines of the Django
> extension <http://freewisdom.org/projects/python-markdown/Django>? I
> want to serve markdown files formatted as HTML in the Klaus
> <https://github.com/jonashaag/klaus#readme> git viewer, which uses Jinja.

Hi,

I don t think there is a need for an extension since any function can be
registered as a filter:

Python:

     import jinja2
     import markdown

     def safe_markdown(text):
         return jinja2.Markup(markdown.markdown(text, ...))

     env = jinja2.Environment(...)
     env.filters['markdown'] = safe_markdown

Templates:

     {{ something.markdown_text|markdown }}
     {% filter markdown %}
         You can have *inline* Markdown too!
     {% endfilter %}

Cheers,
--
Simon Sapin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »