Skip to content

HTML-Escaped Space Not Collapsed at End of Line #618

@jonathan-gruber-jg

Description

@jonathan-gruber-jg

A HTML-escaped space, i.e. an instance of " " (I do not know how to prevent GitHub from thinking that that is a reference to issue 32), at the end of a line is not collapsed with succeeding white space.

Assume that the file paper.md has the below contents.

A 
B

A
B

Assume that the file paper.html has the below contents. Note that paper.html is equivalent HTML to paper.md.

<p>A&#32;
B</p>

<p>A
B</p>

Assume that the file paper.tex has the below contents.

\documentclass{article}

\usepackage{markdown}

\begin{document}
\markdownInput{paper.md}
\end{document}

If I am not mistaken, HTML, and by extension Markdown, collapses consecutive occurrences of certain whitespace characters. Indeed, if paper.html is viewed in a web browser, then "A" and "B" have the same amount of space between them in both paragraphs of the web page, because the "&#32;" (again, I do not know how to prevent GitHub from thinking that that is a reference to issue 32) and the space implied by the newline between "A" and "B" in the first paragraph of the raw HTML are collapsed together into a single space. If paper.tex is typeset into paper.pdf, then we should expect the same situation in paper.pdf. However, when paper.tex is actually typeset into paper.pdf, then the first paragraph of paper.pdf has more space between "A" and "B" than the second paragraph.

System information

TeX distribution: TeX Live 2025.
TeX version: 3.141592653
LuaTeX version: 1.22.0
XeTeX version: 3.141592653-2.6-0.999997
"markdown" package version: 3.13.0-0-gdd212d58
Operating system: Arch Linux with kernel version 6.18.7-arch1-1

Metadata

Metadata

Assignees

Labels

bugconversion outputRelated to the output format of the Markdown-to-TeX conversion

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions