markdown-textwrap

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

commit 472fbff768ad431f3ca030bf899180252394f18d
parent 74a49b17ab90af2fe57a1d10f12550cdca0fad4a
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun,  1 Apr 2018 06:36:09 +0000

md_tw.py: Add TWMarkdown.output_heading.

Add prefix, if it exists, to heading.

* md_tw.py (TWMarkdown.output_heading): Override super class's method.
* tests/data/renderer-heading-w.md: Update file.
* tests/data/renderer-heading.md: Update file.

Diffstat:
md_tw.py | 8++++++++
tests/data/renderer-heading-w.md | 4++++
tests/data/renderer-heading.md | 4++++
3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/md_tw.py b/md_tw.py @@ -356,6 +356,14 @@ class TWMarkdown(mistune.Markdown): if subseq: self.renderer.tw_set(subsequent_indent=p) + def output_heading(self): + rendered_heading = '{}{}'.format( + self.renderer.tw_get('initial_indent'), + super(TWMarkdown, self).output_heading() + ) + + return rendered_heading + def output_block_quote(self): # Add prefix self._add_prefix('> ') diff --git a/tests/data/renderer-heading-w.md b/tests/data/renderer-heading-w.md @@ -9,3 +9,7 @@ Lost our mind. ### Junk Mind In the junkyard. + +> ### Depreston +> +> ...now we got the perculator... diff --git a/tests/data/renderer-heading.md b/tests/data/renderer-heading.md @@ -9,3 +9,7 @@ Lost our mind. ### Junk Mind In the junkyard. + +> ### Depreston +> +> ...now we got the perculator...