Bug 485315

Summary: Incorrect preview when inserting hard line breaks in paragraph with math
Product: [Applications] ghostwriter Reporter: Vursc <gz_wangxm>
Component: generalAssignee: megan.conkle
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 24.02.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Vursc 2024-04-10 09:09:07 UTC
SUMMARY

Preview becomes incorrect when multiple hard line breaks are inserted in paragraph that contains math when using pandoc.

STEPS TO REPRODUCE
1. Launch ghostwriter and create new file with Ctrl+N.
2. Enter "Settings > Preview Options" and change "Markdown Flavor" to any of "Pandoc CommonMark", "Pandoc GitHub-flavored Markdown", "Pandoc PHP Markdown Extra" or "Pandoc Strict". Note that "Pandoc" and "Pandoc MultiMarkdown" do not exhibit this bug.
3. Enter "a$x$b$y$c", without the quotation marks.
4. Move cursor to just before "b", press Shift+Enter.
5. Move cursor to just after "b", press Shift+Enter.

OBSERVED RESULT

Preview contains three lines:
(1) "a" followed by math "x",
(2) "b" followed by math "y" followed by "c",
(3) math "y" followed by "c".

EXPECTED RESULT

Preview contains three lines:
(1) "a" followed by math "x",
(2) "b",
(3) math "y" followed by "c".

SOFTWARE/OS VERSIONS

Arch Linux with Linux kernel version 6.8.2-arch2-1, release "#1 SMP PREEMPT_DYNAMIC Thu, 28 Mar 2024 17:06:35 +0000".

ghostwriter version is 24.02.1-1.
qt5-base version is "5.15.13+kde+r142-1".

ADDITIONAL INFORMATION

The following are only tested with "Pandoc CommonMark":
(1) Inserting the line breaks in reverse order also triggers the bug.
(2) The procedure also triggers the bug for input lines "a$x$byc", "axb$y$c" and "a$$x$$b$$y$$c".
Comment 1 Vursc 2024-04-10 09:10:55 UTC
Forgot to include the output of ghostwriter...

Using pandoc version 3.1.8
Command "multimarkdown" is not available.
Using cmark version 0.31.0
kf.sonnet.core: No language dictionaries for the language: "en_US"
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()