lzanini / mdbook-katex

A preprocessor for mdBook, rendering LaTex equations to HTML at build time.
MIT License
195 stars 34 forks source link

`include-src` breaks if latex source is double-spaced #81

Closed expikr closed 1 year ago

expikr commented 1 year ago

To reproduce, enable include-src and add an equation with extra linebreaks within the $$ block.

It seems that html quotations doesn't close properly when there are extra linebreaks.

Suggestion: minify the included source by removing the linebreaks.

# Chapter 1

$$
\begin{aligned}

f(t) = \int_{-\infty}^{\infty} F(\omega) e^{2\pi i\omega t} d\omega \\

F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-2\pi i\omega t} dt 

\end{aligned}
$$

image

SichangHe commented 1 year ago

This is because mdBook, when parsing

<data class="katex-src" value="
A

B
"><span class="katex-display">…<span>

identifies the two newlines between A and B as a new paragraph and injects <p> between them.

SichangHe commented 1 year ago

This should be fixed in v0.3.14.