PythonAnywhere Forums

HTML Output

So with my Python project, I will have a forum on it as well which I am coding myself.I have a text editor similar to the one here which has buttons for things like bold, center, font size etc. Is there a way that I can have it so that when the user posts something, only those HTML tags are accepted. So if there was another like let's say <strike>, it is just returned as raw text or is completely removed?

Hm. I'm sure someone will have written a tool to do things like this -- have a google search around? Eg I found this: https://pypi.python.org/pypi/html-sanitizer/

Thanks. I didn't know what to call out which is why when I searched for it on Google, I didn't get much help. Managed to find a better one for Flask. Putting it here if anyone has a similar problem in the future :) - https://pypi.python.org/pypi/bleach

[edit by admin: linkified URL]

Thanks for posting it! I've made your URL a link to help bump up the Google-juice for the package :-)