typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 56 forks source link

Blank line before math block gets removed #5787

Open flokno opened 1 year ago

flokno commented 1 year ago

(related: https://github.com/typora/typora-issues/issues/34)

When I create a new paragraph (by hitting enter), the default behavior of Typora in write mode is to enter an empty line, e.g.

some text [hit enter]

new text

However, when a math block follows, that empty line gets removed (I assume because of https://github.com/typora/typora-issues/issues/34), resulting in e.g.

some text[hit enter]
$$
some latex expressions
$$

This leads to incompatibility with github-flavored markdown, which seems to be sensitive to these blank lines:

Example

Some text

$$ \LaTeX \text{ after blank line renders fine} $$

Versus some text $$ \LaTeX \text{ without blank line does not render} $$

Suggested solution

I think Typora's behavior when creating new paragraphs via enter should not change if a math block occurs, i.e., a new line should be injected. The behavior requested in https://github.com/typora/typora-issues/issues/34 should be optional by simply using shift+enter as in normal Typora text writing, which results in a new line instead of a new paragraph

flokno commented 1 month ago

Ping issue: Typora still removes whitespace before code blocks even if that whitespace was there before and is needed to render correctly online.