Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(latex-renderer): thematic break on new line #224

Merged

Conversation

choeppler
Copy link
Contributor

Given the following markdown snippet

line

---

other line

and creating a pdf from the rendered LaTeX with pdflatex, version pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian)), I get
image

However, I'd expect the horizontal rule to be on a separate line as shown in the following image
image

The attached patch fixes that by adding an empty line before the \hrulefill.

To reproduce, run the following script and create a pdf from the resulting LaTeX-file via pdflatex test.tex:

#!/bin/env python3

import mistletoe
from mistletoe.latex_renderer import LaTeXRenderer

def render(f):
   with open(f, 'r') as fp:
     return mistletoe.markdown(fp, LaTeXRenderer)

test = """
line

---

other line
"""

open('test.md', 'w').write(test)
open('test.tex', 'w').write(render('test.md'))

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))
@coveralls
Copy link

Coverage Status

coverage: 94.207%. remained the same
when pulling 4697d0a on boschresearch:fix-latex-render-thematic-break
into 0b7cdf7 on miyuchina:master.

@pbodnar pbodnar added this to the 1.5.0 milestone Sep 29, 2024
@pbodnar pbodnar added the bug label Sep 29, 2024
@pbodnar pbodnar merged commit a40cd2f into miyuchina:master Sep 29, 2024
9 checks passed
@pbodnar
Copy link
Collaborator

pbodnar commented Sep 29, 2024

Seems to make sense, thank you, @choeppler! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants