[Tutor] Having a problem with markdown
ian douglas
ian.douglas at iandouglas.com
Wed Jan 26 08:46:43 CET 2011
Hey all,
I followed a tutorial on creating a very simple wiki in Python, which
worked fine until the example where the instructor wanted to render the
output through markdown.markdown()
Here's the view code:
from agwiki.wiki.models import Page
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
import markdown
def view_page(request, page_name):
try:
page = Page.objects.get(pk=page_name)
except Page.DoesNotExist:
return render_to_response("create.html", {"page_name":page_name})
content = page.content
return
render_to_response("view.html",{"page_name":page_name,"content":markdown.markdown(content)})
The problem I'm having is that the output in a browser is outputing HTML
markers as < and > instead of < and > so the browser literally
shows "<p>hello world</p>". If I leave the line as it originally was:
return
render_to_response("view.html",{"page_name":page_name,"content":content})
It just prints "hello world" as saved in the database. I'm just not sure
where to start looking for a solution here, and would appreciate any
pointers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110125/8916df34/attachment.html>
More information about the Tutor
mailing list