Greetings,
in the release notes for version 2.6 I found the following workaround
for the former "save_mode='escape'" option:
$ cat test
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
import markdown
from markdown.extensions import Extension
class EscapeHtml(Extension):
def extendMarkdown(self, md, md_globals):
del md.preprocessors['html_block']
del md.inlinePatterns['html']
print markdown.markdown('<&>:& becomes &', extensions=[EscapeHtml()])
$ ./test
<p><&>:& becomes &</p>
$
However, I would expect the output to be
<p><&>:& becomes &amp;</p>
and that is also what the former "save_mode='escape'" did. Is there an
easy way to modify the above "EscapeHtml" extension so it will also esc-
ape the "&" in "&"?
Any pointers appreciated.
Sincerely,
Rainer
|