markdown-textwrap

text wrap markdown documents
git clone git://git.ricketyspace.net/markdown-textwrap.git
Log | Files | Refs

commit a93933cf0aee57ed96ca68420cd2d569aff7ea5e
parent 9e8e72506927c619f50b2b0369796c5dfd2da8b5
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun, 18 Feb 2018 19:22:02 +0000

md_tw.py: Add TWRenderer.block_code.

* md_tw.py (TWRenderer)[block_code]: New method.

Diffstat:
md_tw.py | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git 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)