summaryrefslogtreecommitdiff
path: root/src/md.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/md.py')
-rwxr-xr-xsrc/md.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/md.py b/src/md.py
index bcca756..4ab9aa1 100755
--- a/src/md.py
+++ b/src/md.py
@@ -8,6 +8,7 @@ import sys
from jinja2 import Environment, PackageLoader, Template, FileSystemLoader
import mistune
+from mistune.util import escape as escape_text
#global name for templates
article = {}#
@@ -23,6 +24,11 @@ class TocAnchorRenderer(mistune.HTMLRenderer):
html += ' id="toc-' + str(self.count) + '"'
self.count += 1
return html + '>' + text + '</' + tag + '>\n'
+ def block_html(self, html: str) -> str:
+ #if self._escape:
+ # return '<p>' + escape_text(html) + '</p>\n'
+ #return html + '\n'
+ return html
################################################################################
#get first tags and use them to configure some bits
@@ -124,11 +130,17 @@ if not custom_render:
md_rend = html_toc + mistune.html(data)
else:
## Mistune with custom renderer
- markdown = mistune.create_markdown(renderer=TocAnchorRenderer())
+ #markdown = mistune.create_markdown(renderer=TocAnchorRenderer(),escape=False,plugins=['strikethrough', 'footnotes', 'table', 'speedup'])
+ markdown = mistune.create_markdown(
+ escape=False,
+ #plugins=['strikethrough', 'footnotes', 'table', 'speedup'],
+ plugins=['url','table'],
+ renderer=TocAnchorRenderer()
+ )
md_rend = html_toc + markdown(data)
#print t.render( article=article, block = md_rend )
print(t.render( article=article, block = md_rend ))
-
+#print(raw_tags)
f.close() \ No newline at end of file