Hello.
On Mon, Jun 30, 2008 at 2:25 PM, h s <lon...@go...> wrote:
>
> 1. I would like to disallow elements being used in comment forms such
> as headings and images, is there a way to white-/blacklist elements?
You can disallow any raw html in the input by setting `safe_mode` to
one of "replace", "remove", "escape". However, if you mean you want to
disallow markdown markup that represents certain elements, then, no,
that is not currently implemented, nor do I expect it to be. However,
with Python-Markdown's extension API it shouldn't be to hard to write
your own extension that removes the appropriate inline-patterns from
the class instance.
For more information on safe_mode scroll to the bottom of this page:
http://www.freewisdom.org/projects/python-markdown/Using_as_a_Module
For information on writing your own extension see the source as well
as this page:
http://www.freewisdom.org/projects/python-markdown/Writing_Extensions
>
> 2. I couldn´t find how to output a different format than XHTML. Is it
> possible to output HTML4?
>
Unfortunately, this is currently not possible. Python-Markdown uses
it's own DOM implementation which only outputs xhtml. Having the
option to chose difference output formats is on my wishlist, but I
haven't had time to work on a solution yet. There should be some xhtml
-> html tools out there that will do fine though. I don't recall if
ElementTree (in Python2.5 standard library) will do that or not. If
not, BeautifulSoup would be my next choice.
Hope that helps.
--
----
Waylan Limberg
wa...@gm...
|