summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2018-02-18 19:22:02 +0000
committerrsiddharth <s@ricketyspace.net>2018-02-18 19:22:02 +0000
commita93933cf0aee57ed96ca68420cd2d569aff7ea5e (patch)
treed23d8fb78321386a197561b8a287c0c0cf473add
parent9e8e72506927c619f50b2b0369796c5dfd2da8b5 (diff)
md_tw.py: Add TWRenderer.block_code.
* md_tw.py (TWRenderer)[block_code]: New method.
-rw-r--r--md_tw.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/md_tw.py b/md_tw.py
index dbd3a44..ecb75ff 100644
--- a/md_tw.py
+++ b/md_tw.py
@@ -256,6 +256,11 @@ class TWRenderer(mistune.Renderer):
self.tw_set(**kwargs)
return self.tw.fill(text)
+ def block_code(self, code, lang=None):
+ out = '{}'.format(code)
+ out = textwrap.indent(out, self.tw_get('initial_indent'),
+ lambda line: True)
+ return out
def paragraph(self, text):
wrapped = self._tw_fill(text)