|
From: Waylan L. <way...@ic...> - 2016-04-06 19:32:11
|
Sorry for the delayed response. I found this message at the bottom of a long list of things waiting for me to write a reply.
If you would like HTML entities to be escaped as well as HTML tags, then you can remove the `entity` inlinePattern. Just add the appropriate line to your Extension class:
class EscapeHtml(Extension):
def extendMarkdown(self, md, md_globals):
del md.preprocessors['html_block']
del md.inlinePatterns['html']
del md.inlinePatterns['entity']
Hope that helps.
Waylan Limberg
On Mar 25, 2016, at 11:57 AM, Dr Rainer Woitok <rai...@gm...> wrote:
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
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Python-markdown-discuss mailing list
Pyt...@li...
https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
|