From a40cd2fceb4c4f8193aa9b227e4906b01891439a Mon Sep 17 00:00:00 2001 From: Chris Hoeppler Date: Wed, 28 Aug 2024 15:53:56 +0200 Subject: [PATCH] fix(latex-renderer): thematic break on new line Preceed `\hrulefill` by an empty line, so the thematic break is rendered as a separate horizontal line between blocks of text. Otherwise, the last line of the preceeding paragraph is filled with a horizontal rule. (Tested with pdflatex, version pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian)) --- mistletoe/latex_renderer.py | 2 +- test/test_latex_renderer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mistletoe/latex_renderer.py b/mistletoe/latex_renderer.py index 7048fbd..c2ab197 100644 --- a/mistletoe/latex_renderer.py +++ b/mistletoe/latex_renderer.py @@ -158,7 +158,7 @@ def render_table_cell(self, token): @staticmethod def render_thematic_break(token): - return '\\hrulefill\n' + return '\n\\hrulefill\n' @staticmethod def render_line_break(token): diff --git a/test/test_latex_renderer.py b/test/test_latex_renderer.py index 23e9e09..865d91c 100644 --- a/test/test_latex_renderer.py +++ b/test/test_latex_renderer.py @@ -120,7 +120,7 @@ def test_table_cell(self): self._test_token('TableCell', 'inner') def test_thematic_break(self): - self._test_token('ThematicBreak', '\\hrulefill\n') + self._test_token('ThematicBreak', '\n\\hrulefill\n') def test_line_break(self): self._test_token('LineBreak', '\\newline\n', soft=False)