|
From: Dr R. W. <rai...@gm...> - 2019-01-15 11:58:38
|
Waylan,
On Wednesday, 2016-04-06 18:31:57 +0000, you wrote:
> ...
> 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.
This was 2.75 years ago and it solved my problem, which was:
> ...
> On Mar 25, 2016, at 11:57 AM, Dr Rainer Woitok <rai...@gm...> wrote:
> ...
> $ 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>
More precisely, it at least worked until changeset "81fb14216e8c" (dated
2018-06-28 23:33:34 +0300) in the source repository. However, after re-
installing Markdown from changeset "596be577c69c" (dated 2018-12-22 15:
51:30 -0500) and re-running my little test script I'm now again getting
<p><&>:& becomes &</p>
What do I have to change this time?
Sincerely,
Rainer
|