|
From: Dr R. W. <rai...@gm...> - 2019-01-22 13:18:05
|
Waylan,
On Sunday, 2019-01-20 15:35:57 -0500, you wrote:
> ...
> class EscapeHTML(Extension):
> def extendMarkdown(self, md, md_globals):
> md.preprocessors.deregister(‘html_block’)
> md.inlinePatterns.deregister(‘html’)
> md.inlinePatterns.deregister(‘entity’)
This time this didn't help:
$ cat test.py
# -*- coding: iso-8859-1 -*-
import markdown
from markdown.extensions import Extension
class EscapeHtml(Extension):
def extendMarkdown(self, md, md_globals):
md.inlinePatterns.deregister('entity')
md.inlinePatterns.deregister('html')
md.preprocessors.deregister('html_block')
print(markdown.__version__)
print(markdown.markdown('<&>:& becomes &', extensions=[EscapeHtml()]))
$ python test.py
3.1.dev0
<p><&>:& becomes &</p>
$
However, I need _EVERY_ "&" in the original Markdown text to be trans-
lated to "&" in the HTML file. Thus the raw text "becomes &"
should be turned into "becomes &amp;". How can I achieve this in
version 3.0 and up?
At least with Markdown version 2.6.10 and lower removing "entity" from
"inlinePatterns" really did the trick, but not so in 3.0 and above.
Sincerely,
Rainer
|