Would it not be possible to run it through the striptags filter first
and then pass it into markdown?

Michael Trier
blog.michaeltrier.com

On Dec 2, 2007 9:50 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
>
> On Sun, 2007-12-02 at 18:26 -0800, [EMAIL PROTECTED] wrote:
> > i have field like this:
> >                             body = models.TextField()
> > i want it only accept text without HTML code?
> > i used body=markdown.markdown(text,safe_mode = True), but this will
> > repalce HTML code with "HTML_REMOVED".
> >
> > is there other way can make sure only text content? thanks!
>
> You could run it through BeautifulSoup ([1]) and then extract the
> contents from each node in the tree. Not blindingly fast, but pretty
> robust.
>
> [1] http://www.crummy.com/software/BeautifulSoup/
>
> Regards,
> Malcolm
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to