summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-05-21 17:44:48 +0100
committerFreeArtMan <dos21h@gmail.com>2017-05-21 17:44:48 +0100
commit4c6a1c2f77f5cf5b187911256c9de7b72fe1b65e (patch)
treefaadb9afa4dd884bae0f7300e0e5499c98be0a43
parent0e3bf8fe600072a715764a150dc3c27b6e57da58 (diff)
downloadmd-site-4c6a1c2f77f5cf5b187911256c9de7b72fe1b65e.tar.gz
md-site-4c6a1c2f77f5cf5b187911256c9de7b72fe1b65e.zip
Added image markdown custom renderer
-rwxr-xr-xsrc/md.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/md.py b/src/md.py
index 8c131a4..31d5e9e 100755
--- a/src/md.py
+++ b/src/md.py
@@ -29,6 +29,7 @@ class TocMixin():
self.toc_tree = []
self.toc_count = 0
self.title = None
+ self.img_count = -1
def header(self, text, level, raw=None):
rv = ""
@@ -42,6 +43,13 @@ class TocMixin():
self.toc_count += 1
return rv
+ #Lets do previev image
+ def image(self, src, title, alt_text):
+ prev_img = src.split(".")
+ prev_img = prev_img[0]+"_prev."+prev_img[1]
+ self.img_count += 1
+ return "<a href="+src+"><img src=\""+prev_img+"\" alt=\""+alt_text+"\"></a>"
+
def render_toc(self, level=3):
"""Render TOC to HTML.