diff options
author | Arturs Artamonovs <dos21h@gmail.com> | 2023-01-29 16:52:57 +0000 |
---|---|---|
committer | Arturs Artamonovs <dos21h@gmail.com> | 2023-01-29 16:52:57 +0000 |
commit | ecd9e407916a8aa264a9e5added59f3edb1e7de0 (patch) | |
tree | 0dad876fb9b79d642903e5ceed549a772fb14e2d /src | |
parent | cf3ea4c1cf323f71e8e680af074d95e91810ba9e (diff) | |
download | md-site-ecd9e407916a8aa264a9e5added59f3edb1e7de0.tar.gz md-site-ecd9e407916a8aa264a9e5added59f3edb1e7de0.zip |
fixed url and html
Diffstat (limited to 'src')
-rwxr-xr-x | src/md.py | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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 |