summaryrefslogtreecommitdiff
path: root/src/md.py
diff options
context:
space:
mode:
authorArturs Artamonovs <dos21h@gmail.com>2023-01-29 16:52:57 +0000
committerArturs Artamonovs <dos21h@gmail.com>2023-01-29 16:52:57 +0000
commitecd9e407916a8aa264a9e5added59f3edb1e7de0 (patch)
tree0dad876fb9b79d642903e5ceed549a772fb14e2d /src/md.py
parentcf3ea4c1cf323f71e8e680af074d95e91810ba9e (diff)
downloadmd-site-ecd9e407916a8aa264a9e5added59f3edb1e7de0.tar.gz
md-site-ecd9e407916a8aa264a9e5added59f3edb1e7de0.zip
fixed url and html
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